[URL Rewriting] Distinguer deux cas suivant le chemin utilisé
Bonjour,
J'ai un petit souci quant à l'url rewriting, c'est-à-dire que je souhaiterais que tout type d'url de la forme : http://mondomaine.com/blabla15 redirige vers l'index.php et que tout type d'url de la forme http://mondomaine.com/blabla15/gfgdf85 redirige vers la page error 404.
Voici ce que j'ai fait :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| RewriteEngine on
ErrorDocument 401 http://localhost/error.php?error=401
ErrorDocument 403 http://localhost/error.php?error=403
ErrorDocument 404 http://localhost/error.php?error=404
ErrorDocument 500 http://localhost/error.php?error=500
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} !^/robots.txt
RewriteCond %{REQUEST_URI} !^/contests/
RewriteCond %{REQUEST_URI} !^/design/
RewriteCond %{REQUEST_URI} !^/downloads/
RewriteCond %{REQUEST_URI} !^/forum/
RewriteCond %{REQUEST_URI} !^/inc/
RewriteCond %{REQUEST_URI} !^/js/
RewriteCond %{REQUEST_URI} !^/lang/
RewriteCond %{REQUEST_URI} !^/news/
RewriteCond %{REQUEST_URI} !^/partners/
RewriteCond %{REQUEST_URI} !^/rss/
RewriteCond %{REQUEST_URI} !^/shellpacks/
RewriteCond %{REQUEST_URI} !^/tutorials/
RewriteRule (.*)$ index.php |
Avec ceci, tout type d'url de la forme http://mondomaine.com/blabla15 est bien redirigé vers l'index.php. Tout type d'url de la forme http://mondomaine.com/blabla15/gfgdf85 est redirigé vers l'index.php au lieu d'être redirigé vers la page error.php.
Pourriez-vous m'aider s'il-vous-plaît ?