Andrea Visinoni wrote:
Hi there,
i need to implement url rewrite on a website and i need to obtain
something like that:
http://site.com/a/ -> index.php?1=a
http://site.com/a/b/ -> index.php?1=a&2=b
http://site.com/a/b/c/ -> index.php?1=a&2=b&3=c
is this possible?
by now i was able to do that:
RewriteEngine on
RewriteRule ^(.*)/$ index.php?page=$1 [L]
but i get all the parameters (a/b/c/) as a unique parameter in page.
Hi.
I'm not a specialist of mod_rewrite, but
a) yes, you can certainly achieve something like that
b) let me try to give a hint :
You would probably have to do that with 3 sets of RewriteCond +
RewriteRule, like :
first set :
RewriteCond matching the longest one of the links :
^(\/([^/]+)\/([^/]+)\/([^/]+)\/
+ RewriteRule using index.php?1=$1&2=$2&3=$3 [L]
second set :
RewriteCond matching :
^(\/([^/]+)\/([^/]+)\/
+ RewriteRule using index.php?1=$1&2=$2 [L]
third set :
RewriteCond matching :
^(\/([^/]+)\/
+ RewriteRule using index.php?1=$1 [L]
the rest is left to the sagacity of the reader ;-)
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [email protected]
" from the digest: [email protected]
For additional commands, e-mail: [email protected]