我需要這2重寫規則幫助:重寫規則 - 環重定向
RewriteEngine On
RewriteBase/
# folder/script.php?A=1&B=2 -> xyz/1/2 (REDIRECT)
RewriteCond %{QUERY_STRING} ^A=([^&]+)&B=([^&]+)$
RewriteRule ^folder\/script\.php$ /xyz/%1/%2? [R=301,L]
# xyz/1/2 -> folder/script.php?A=1&B=2 (REWRITE)
RewriteRule ^xyz\/([^\/]+)\/([^\/]+)$ /folder/script.php?A=$1&B=$2 [L]
首先,我需要 「重定向」
FROM:efectorelativo.net/folder/script.php?A=1 & B = 2
TO:efectorelativo.net/xyz/1/2然後我需要 「改寫」 未 「重定向」
FROM:EFEC torelativo.net/xyz/1/2
TO:efectorelativo.net/folder/script.php?A=1 & B = 2
編輯:(工作碼,這要歸功於秋葵)
RewriteEngine On
RewriteBase/
# folder/script.php?A=1&B=2 -> xyz/1/2 (REDIRECT)
RewriteCond %{THE_REQUEST} \?A=([^&]+)&B=([^\s&]+)
RewriteRule ^folder\/script\.php$ /xyz/%1/%2? [R=301,L]
# xyz/1/2 -> folder/script.php?A=1&B=2 (REWRITE)
RewriteRule ^xyz\/([^\/]+)\/([^\/]+)$ /folder/script.php?A=$1&B=$2 [L]
葉氏,這將使一個循環。你在問什麼? – 2010-10-29 18:29:40
我在問我該如何解決這個問題。 – Luistar15 2010-10-29 19:17:04