Rewrite Rule qui empeche un autre Rewrite Rule :(

WRInaute occasionnel
Bonjour, voila mon probleme, j'ai 2 pages departement.php et villes.php on y accede via www.site.com/region/departement.html et par www.site.com/region/departement/ville.html

mon code :
Code:
RewriteRule ^(.*)/(.*)\.html$ /Portail/departement.php?rg=$1&dpt=$2 [L]
RewriteRule ^(.*)/(.*)/(.*)\.html$ /Portail/ville.php?rg=$1&dpt=$2&city=$3 [L]

Le premier marche très bien, mais mon deuxieme est "écrasé" par le premier, je comprend pas trop pourquoi ? Auriez vous une idée, suggestion ou autres ?

Merci !
 
WRInaute discret
C'est parce que la seconde condition est aussi valable dans la première.
Pour aller vite passe la seconde en premier :

RewriteRule ^(.*)/(.*)/(.*)\.html$ /Portail/ville.php?rg=$1&dpt=$2&city=$3 [L]
RewriteRule ^(.*)/(.*)\.html$ /Portail/departement.php?rg=$1&dpt=$2 [L]

sinon essaye

RewriteRule ^([^\/]+)/([^\/]+)\.html$ /Portail/departement.php?rg=$1&dpt=$2 [L]
RewriteRule ^([^\/]+)/([^\/]+)/([^\/]+)\.html$ /Portail/ville.php?rg=$1&dpt=$2&city=$3 [L]
 
WRInaute occasionnel
la premiere solution marche, comme je suis en local bien penser a redémarrer apache :/
 
Discussions similaires
Haut