How can I translate an URL like: http://localhost/mySite/?link=OFFERS&sublink=ARTICLE&subsublink=DETAIL
to: http://localhost/mySite/OFFERS/ARTICLE/DETAIL
if one parameter is empty it should still work like this: localhost/mySite/?link=OFFERS&sublink=ARTICLE localhost/mySite/OFFERS/ARTICLE
Extra problem: There is an enter page under index.php and the rewrite should work with index2.php. Best would be if it would work under localhost and on live system without changes.
Currently I'm using: RewriteRule ^([^/.]+)$ index2.php?link=$1 [L] But that only works for one parameter and I couldn't improve this code for ages ^^
RewriteRule ^([^/.]+)(/([^/.]+))?(/([^/.]+))?$ index2.php?link=$1&sublink=$3&subsublink=$5 [L,QSA]
Note that localhost/mySite/OFFERS/ARTICLE
links to localhost/mySite/?link=OFFERS&sublink=ARTICLE&sussublink=
and not localhost/mySite/?link=OFFERS&sublink=ARTICLE
.
Should not be a big issue, but make sure the PHP code doesn't us isset($_GET['subsublink'])
.