Beginner's apache mod_rewrite assistance with .htaccess configuration
noob when it comes to .htaccess.
I need a mod_rewrite of a URL. URL example is as shown:
http://example.com/folder/script.php?location=UK&Name=Fred
开发者_运维知识库
I want it to transform to:
http://example.com/folder/UK/Fred
RewriteCond %{QUERY_STRING} location=([^&]+)&Name=(.+)
RewriteRule ^/folder/script.php$ http://website.com/folder/%1/%2? [R]
Try this rule:
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ $1/script.php?location=$2&Name=$3
This will rewrite requests to /<folder>/<location>/<Name>
internally to /<folder>/script.php?location=<location>&Name=<Name>
.
精彩评论