website/.htaccess

26 lines
782 B
ApacheConf
Raw Normal View History

# Désactiver l'affichage des dossiers
2026-02-06 18:36:03 +01:00
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
2026-04-05 20:49:52 +02:00
# 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]
2026-04-05 20:49:52 +02:00
# 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>
2026-04-05 20:49:52 +02:00
# Page d'erreur Apache native (fallback si mod_rewrite absent)
ErrorDocument 404 /pages/404.php
ErrorDocument 403 /pages/404.php