htaccess fini
This commit is contained in:
parent
5071d5f2f3
commit
b75ae2542a
22 changed files with 101 additions and 105 deletions
26
.htaccess
26
.htaccess
|
|
@ -1,33 +1,31 @@
|
|||
Options -Indexes
|
||||
|
||||
# --- Sécurité ---
|
||||
<FilesMatch ".env">
|
||||
Require all denied
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "(composer\.json|composer\.lock|package\.json|package-lock\.json|\.git|\.env|\.gitignore|env)">
|
||||
Require all denied
|
||||
</FilesMatch>
|
||||
|
||||
RewriteEngine On
|
||||
# Gestion des erreurs
|
||||
ErrorDocument 404 /error/error_404
|
||||
ErrorDocument 403 /error/error_403
|
||||
|
||||
# 2. Bloquer l'accès direct au dossier vendor
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
|
||||
# Bloquer l'accès direct au dossier vendor
|
||||
RewriteRule ^vendor/ - [F,L]
|
||||
|
||||
# 3. Autoriser l'accès aux fichiers/dossiers physiques (images, css, js)
|
||||
# Autoriser l'accès aux fichiers/dossiers physiques (images, css, js)
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
|
||||
# 4. RACINE : accueil par défaut
|
||||
# RACINE : accueil par défaut
|
||||
RewriteRule ^$ index.php?ctrl=project&action=home [QSA,L]
|
||||
|
||||
# 5. ID NUMÉRIQUE : /ctrl/action/42
|
||||
# ID NUMÉRIQUE : /ctrl/action/42
|
||||
RewriteRule ^([a-zA-Z]+)/([a-zA-Z_]+)/([0-9]+)/?$ index.php?ctrl=$1&action=$2&id=$3 [QSA,L]
|
||||
|
||||
# 6. PSEUDO : /user/profile/johndoe
|
||||
# PSEUDO : /user/profile/johndoe
|
||||
RewriteRule ^([a-zA-Z]+)/([a-zA-Z_]+)/([a-zA-Z0-9_-]+)/?$ index.php?ctrl=$1&action=$2&pseudo=$3 [QSA,L]
|
||||
|
||||
# 7. RÉÉCRITURE GÉNÉRALE (inclut tes erreurs) : /ctrl/action
|
||||
# C'est cette règle qui va transformer "/error/error_404"
|
||||
# en "index.php?ctrl=error&action=error_404"
|
||||
# RÉÉCRITURE GÉNÉRALE : /ctrl/action
|
||||
RewriteRule ^([a-zA-Z]+)/([a-zA-Z_]+)/?$ index.php?ctrl=$1&action=$2 [QSA,L]
|
||||
Loading…
Add table
Add a link
Reference in a new issue