DirectoryIndex index.html index.php index.shtml index.htm
Options -Indexes -MultiViews
AddDefaultCharset utf-8

# Prevent PHP/ASP execution — serve as static HTML
# This is critical: restored .php files contain HTML, not PHP code
<IfModule mod_php.c>
  php_flag engine off
</IfModule>
<IfModule mod_php7.c>
  php_flag engine off
</IfModule>
<IfModule mod_php8.c>
  php_flag engine off
</IfModule>
RemoveHandler .php .phtml .php3 .php4 .php5 .php7 .php8
RemoveHandler .asp .aspx .cfm
<IfModule mod_mime.c>
  AddType text/html .html .htm .shtml .php .asp .aspx .cfm
</IfModule>
<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
</IfModule>
RewriteEngine On

# Canonical host redirect (skipped in preview mode)
RewriteCond %{ENV:RESTORE_INK_PREVIEW} !1
RewriteCond %{HTTP_HOST} !^ihaventseenthat\.com$ [NC]
RewriteRule ^(.*)$ https://ihaventseenthat.com/$1 [L,R=301]

# Serve existing files directly
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# Trailing slash → .html
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{DOCUMENT_ROOT}%1\.html -f
RewriteRule ^(.+)/$ /$1.html [L]

# Extensionless → .html
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/(.+?)$
RewriteCond %{DOCUMENT_ROOT}/%1\.html -f
RewriteRule ^(.+?)$ /$1.html [L]

