RewriteEngine On

# Force correct MIME types for static files — prevent PHP/HTML interference
<FilesMatch "\.xml$">
    ForceType text/xml
    Header set Content-Type "text/xml; charset=UTF-8"
</FilesMatch>
<FilesMatch "\.txt$">
    ForceType text/plain
    Header set Content-Type "text/plain; charset=UTF-8"
</FilesMatch>

# Redirect root / to index.html
RewriteRule ^$ index.html [L]

# If the request is for an actual file or directory, serve it directly
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Clean URLs: append .html if the file exists
# Example: /agency-policy → agency-policy.html
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L]