I've created some url rewriting rules.
It works fine.
But i have 2 pages with urls like that :
actualites.php?id=xxx& alias=xxx
--> Result : id-alias.php (ex : 1-article_name.php)
equipe.php?id=xxx& alias=xxx
--> Result : id-alias.php ((ex : 1-article_name.php)
These 2 pages are different, not the same design, etc.
I would like to rewrite these 2 different pages. My question is how to have two different rules for these 2 urls.
Since they have 2 parameters, i have only one rule applied (the first one)
#become : 1-alias.php
RewriteRule ^([0-9]*)-(.*)\.php$ actualites.php?cat=$1&alias=$2 [L]
#become : 1-alias.php
RewriteRule ^([0-9]*)-(.*)\.php$ equipe.php?id_equipe=$1&alias=$2 [L]
Unless you want to add code in actualites.php
that first checks whether the parameter values for "cat" and "alias" are valid, then you can't.
If you want to code that into actualites.php
, check if the parameters are valid, and if not, send the params to equipe.php
as "id_equipe" and "alias". Otherwise you'll need to add something to the URL to validate which request you're actually mapping to. For example:
http://yourdomain.com/a/1-article.php --> /actualites.php?cat=1&alias=article
http://yourdomain.com/e/1-article.php --> /equipe.php?id_equipe=1&alias=article
Without that /a/
or /e/
, there's no way to tell what to map to. If you don't use something like that, you'll need to do all validation in your php.