website/.htaccess
2026-04-05 20:49:52 +02:00

25 lines
782 B
ApacheConf

# Désactiver l'affichage des dossiers
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
# Force HTTPS (décommenter en production)
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Si le fichier ou dossier demandé n'existe pas → 404
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ pages/404.php [L]
# Dossier sans index → 404
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule ^ pages/404.php [L]
</IfModule>
# Page d'erreur Apache native (fallback si mod_rewrite absent)
ErrorDocument 404 /pages/404.php
ErrorDocument 403 /pages/404.php