开发者

mod_rewrite > /user/tag1/tag2/tag..?page=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 rea开发者_如何学运维lly appreciated!


For the single tag use the following:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜