tags:

views:

28

answers:

1

I am trying to use mod_rewrite to pretty up a URL.

I want the URL to look like this:

http://example.com/bart/school?page=2

and the rewritten URL to be:

http://localhost:8080/app?user=bart&tag1=school&page=2

If possible, I would also like to be able to have more than one tag per user:

http://example.com/bart/school/lisa?page=2

Would look like:

http://localhost:8080/app?user=bart&tag1=school&tag2=lisa&page=2

I far as I can tell this is possible by using mod_rewrite but I can't seem to figure it out. Any help would be really appreciated!

A: 

For the single tag use the following:

RewriteCond %{QUERY_STRING} ^page=([0-9]+)$
RewriteRule ^([^.]+)/([^.]+)$ http://localhost:8080/app?user=$1&tag1=$2&page=%1
Lizard