# Caresoft VMS marketing site
# Point the vhost DocumentRoot here; the application lives one level up and is
# reached by its own paths (/visitor, /gate, /client, /superadmin).

Options -Indexes
RewriteEngine On

# Crawler files
RewriteRule ^sitemap\.xml$  sitemap.php [L]
RewriteRule ^llms\.txt$     llms.php    [L]

# Programmatic location pages
RewriteRule ^visitor-management-system-([a-z0-9-]+)/?$ page.php?loc=$1 [L,QSA]

# Trailing-slash and index.php canonicalisation, so one page never has
# two indexable URLs.
RewriteCond %{THE_REQUEST} \s/index\.php[\s?] [NC]
RewriteRule ^index\.php$ / [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

# The SEO config is data, not a page.
<FilesMatch "^(seo-config)\.php$">
    Require all denied
</FilesMatch>

# Long cache on static assets, none on generated pages.
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/png  "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType text/css   "access plus 1 year"
</IfModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/json application/xml
</IfModule>
