我具有以下設置阿帕奇mod_rewrite的[R,C]不工作
RewriteCond %{REQUEST_URI} ^/search.php$
RewriteCond %{QUERY_STRING} ^what=(.*)&where=(.*)$
RewriteRule^/%1/%2? [R=302]
採用這種設置一切工作作爲例外
example.com/search.php?what=foo &其中=巴
改寫爲
example.com/foo/bar
但是我還需要再次打的search.php,所以我說
RewriteCond %{REQUEST_URI} ^/search.php$
RewriteCond %{QUERY_STRING} ^what=(.*)&where=(.*)$
RewriteRule^/%1/%2? [R=302,C]
RewriteRule^/search.php?what=$1&where=$2 [L]
現在是「跳過」重定向和重寫
從 example.com/search.php?what=foo &哪裏= bar 至 example.com/search.php?what=foo & where = bar
重定向不能用C標誌嗎?
對不起,這是不是一種選擇。我需要將example.com/search.php?what=foo&where=bar重寫爲example.com/foo/bar,但我希望將example.com/foo/bar重寫爲example.com/search.php?what=foo&where =酒吧 – Rooterle