开发者

Rewriting query URL

Suppose I have URLs with query string parameters like these:

index.php?lag=en&name=About Us&itemid=60
index.php?host=consumer&lag=en&name=About Us&am开发者_StackOverflowp;itemid=64

Using mod_rewrite, how can I redirect them like these?

en_About Us_60.php
consumer/en_About Us_64.php

In the Above urls values are dynamic.


Something like this:

RewriteEngine on 
RewriteCond %{QUERY_STRING} host=(.*)&lag=(.*)&name=(.*)&itemid=(.*)
RewriteRule ^index.php(.*)$ /%1/%2_%3_%4 [QSA]

RewriteCond %{QUERY_STRING} lag=(.*)&name=(.*)&itemid=(.*)
RewriteRule ^index.php(.*)$ /%1_%2_%3 [QSA]

Remember, to check all the statements, which are possible ;)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜