0
noob當涉及到.htaccess。Beginner's apache mod_rewrite援助.htaccess配置
我需要一個URL的mod_rewrite。 URL示例如下所示:
http://example.com/folder/script.php?location=UK&Name=Fred
我希望它轉換爲:
http://example.com/folder/UK/Fred
noob當涉及到.htaccess。Beginner's apache mod_rewrite援助.htaccess配置
我需要一個URL的mod_rewrite。 URL示例如下所示:
http://example.com/folder/script.php?location=UK&Name=Fred
我希望它轉換爲:
http://example.com/folder/UK/Fred
RewriteCond %{QUERY_STRING} location=([^&]+)&Name=(.+)
RewriteRule ^/folder/script.php$ http://website.com/folder/%1/%2? [R]
試試這個規則:
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ $1/script.php?location=$2&Name=$3
這將改寫請求/<folder>/<location>/<Name>
內部到/<folder>/script.php?location=<location>&Name=<Name>
。
除了下面的答案,我發現這個網站的重寫規則檢查有用:http://civilolydnad.se/projects/rewriterule/ – Paolo 2010-02-05 19:21:26