noob。
我需要一个URL的mod_rewrite。 URL示例如下所示:
http://example.com/folder/script.php?location=UK&Name=Fred
我希望它转换为:
http://example.com/folder/UK/Fred
答案 0 :(得分:1)
尝试此规则:
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ $1/script.php?location=$2&Name=$3
这会将/<folder>/<location>/<Name>
内部的请求重写为/<folder>/script.php?location=<location>&Name=<Name>
。
答案 1 :(得分:1)
RewriteCond %{QUERY_STRING} location=([^&]+)&Name=(.+)
RewriteRule ^/folder/script.php$ http://website.com/folder/%1/%2? [R]