# <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 Cross-Origin-Opener-Policy "same-origin-allow-popups"
# </IfModule>


RewriteEngine On 
RewriteCond %{HTTPS} !on 
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ 
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


RewriteEngine On
RewriteBase /Sale/

# Redirect .html URLs to clean URL
RewriteCond %{THE_REQUEST} \s/+(.+?)\.html[\s?]
RewriteRule ^ %1 [R=301,L]

# Serve .html files when extension is not typed
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.+)$ $1.html [L]

# Default home page
DirectoryIndex index.html

# ----------------------------------------------------------------------
# Browser Caching for Static Assets
# ----------------------------------------------------------------------
<IfModule mod_expires.c>
  ExpiresActive On

  # Images
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png  "access plus 1 year"
  ExpiresByType image/gif  "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"

  # Fonts
  ExpiresByType font/woff "access plus 1 year"
  ExpiresByType font/woff2 "access plus 1 year"
  ExpiresByType application/font-woff "access plus 1 year"
  ExpiresByType application/font-ttf "access plus 1 year"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 year"

  

  # CSS and JavaScript
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/javascript "access plus 1 year"
</IfModule>

# ----------------------------------------------------------------------
# Strong Cache-Control Headers
# ----------------------------------------------------------------------
<IfModule mod_headers.c>
  <FilesMatch "\.(ico|jpe?g|png|gif|webp|svg|woff2?|ttf|eot|css|js)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
</IfModule>

<IfModule mod_headers.c>
  <FilesMatch "\.(mp4|mov|webm)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
</IfModule>

# ----------------------------------------------------------------------
# ✅ Basic Security Headers (Safe + Functional)
# ----------------------------------------------------------------------
<IfModule mod_headers.c>
  # Content Security Policy (light version - allows all required resources)
  Header set Content-Security-Policy "default-src * data: blob: 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests;"
  
  # Strict Transport Security (forces HTTPS)
  Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

  # Prevent MIME type sniffing
  Header set X-Content-Type-Options "nosniff"

  # Referrer Policy for privacy
  Header set Referrer-Policy "strict-origin-when-cross-origin"

  # Legacy XSS Protection
  Header set X-XSS-Protection "1; mode=block"

  # Clickjacking protection (safe)
  Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>




