# BonBudget — site vitrine (o2switch / Apache)
Options -Indexes
AddDefaultCharset UTF-8
<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 "DENY"
  Header always set Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self'; script-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'self'"
  <FilesMatch "\.(webp|css|js|svg|png)$">
    Header set Cache-Control "public, max-age=2592000"
  </FilesMatch>
</IfModule>
<IfModule mod_expires:c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 1 month"
</IfModule>
# Force HTTPS
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !=https
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# Référencement : une seule adresse par page (www, sans /index.html)
<IfModule mod_rewrite.c>
  RewriteCond %{HTTP_HOST} ^bonbudget\.fr$ [NC]
  RewriteRule ^ https://www.bonbudget.fr%{REQUEST_URI} [L,R=301]
  RewriteCond %{THE_REQUEST} \s/index\.html[\s?] [NC]
  RewriteRule ^index\.html$ / [L,R=301]
</IfModule>
# Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript image/svg+xml application/xml text/plain application/ld+json
</IfModule>
<IfModule mod_headers.c>
  <FilesMatch "\.(html|xml|txt)$">
    Header set Cache-Control "public, max-age=3600"
  </FilesMatch>
  <FilesMatch "^robots\.txt$">
    Header set Cache-Control "public, max-age=3600"
  </FilesMatch>
</IfModule>
