# DigiSites storefront — generated. Do not edit (rebuild instead).
Options -Indexes -MultiViews
DirectoryIndex index.php
ErrorDocument 404 /404.php

<IfModule mod_rewrite.c>
RewriteEngine On

# Force HTTPS (skip on local dev)
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_HOST} !^(localhost|127\.0\.0\.1)
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Canonical host: strip www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

# Private folders
RewriteRule ^(data|inc|api)(/|$) - [F,L]

# Pretty URLs
RewriteRule ^products/([a-z0-9\-]+)/?$ product.php?slug=$1 [L,QSA]
RewriteRule ^guides/?$ guides.php [L,QSA]
RewriteRule ^guides/([a-z0-9\-]+)/?$ guide.php?slug=$1 [L,QSA]
RewriteRule ^author/([a-z0-9\-]+)/?$ author.php?slug=$1 [L,QSA]
RewriteRule ^(about|contact|terms|privacy|refund-policy)/?$ page.php?p=$1 [L,QSA]
RewriteRule ^downloads/([a-f0-9]{40})/?$ downloads.php?t=$1 [L,QSA]
RewriteRule ^download/([a-f0-9]{40})/([0-9]+)/?$ download.php?t=$1&f=$2 [L,QSA]
RewriteRule ^(checkout|thank-you|access|subscribe|unsubscribe)/?$ $1.php [L,QSA]
</IfModule>

<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
<FilesMatch "\.(css|js|png|jpe?g|webp|svg|ico|woff2?)$">
  Header set Cache-Control "public, max-age=2592000"
</FilesMatch>
<FilesMatch "^(llms\.txt|llms-full\.txt|robots\.txt|sitemap\.xml)$">
  Header set Cache-Control "public, max-age=3600"
  Header set X-Robots-Tag "noindex"
</FilesMatch>
<FilesMatch "^llms(-full)?\.txt$">
  Header set Content-Type "text/markdown; charset=utf-8"
</FilesMatch>
</IfModule>

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