# Generated by Affiliate Site Generator
# Generated at: 2026-11-05T14:16:49.010Z

# Character encoding
AddDefaultCharset UTF-8

# Force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Redirect to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://medicitourflorence.com/$1 [L,R=301]

# Enable Gzip Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/json
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>

# Enable Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  
  # Images
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"
  
  # CSS and JavaScript
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  
  # Fonts
  ExpiresByType font/woff2 "access plus 1 year"
  ExpiresByType font/woff "access plus 1 year"
  ExpiresByType font/ttf "access plus 1 year"
  
  # HTML
  ExpiresByType text/html "access plus 1 hour"
</IfModule>

# Cache-Control Headers
#
# NOTE: generated asset filenames are NOT content-hashed — every build
# writes the same assets/styles.css and assets/scripts.js. "immutable"
# promises the bytes at a URL will never change, which is false here, and
# it tells browsers not to revalidate even on reload. A template fix then
# never reaches returning visitors. Long-lived caching may only come back
# alongside hashed filenames.
<IfModule mod_headers.c>
  <FilesMatch "\.(ico|jpe?g|png|gif|webp|svg|woff2?|ttf|css|js)$">
    Header set Cache-Control "public, max-age=3600, must-revalidate"
  </FilesMatch>
  <FilesMatch "\.(html|htm)$">
    Header set Cache-Control "public, max-age=3600, must-revalidate"
  </FilesMatch>
</IfModule>

# Security Headers
<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set X-XSS-Protection "1; mode=block"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# Prevent Directory Listing
Options -Indexes

# Block Access to Sensitive Files
<FilesMatch "^\.(htaccess|htpasswd|env|git|gitignore)">
  Order allow,deny
  Deny from all
</FilesMatch>

# Custom Error Pages
ErrorDocument 404 /404.html
