我想在.htaccess文件中編寫規則。重寫規則不影響網站
我寫的規則是這樣的:
RewriteCond %{QUERY_STRING} ^id=([0-9]+)&dgid=([0-9]+)$
RewriteRule destination_content-id-(.*)-dgid-(.*)\.htm$ destination_content.html?id=$1&dgid=$2 [L]
重新啓動服務器。
在它有以下規則之前。
RewriteEngine on
# Parse out basename, but remember the fact.
RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
# Rewrite to document.phtml if exists...
RewriteCond %{REQUEST_FILENAME}.phtml -f
RewriteRule ^(.*)$ $1.phtml [S=1]
# ...else reverse the previous basename cutout.
RewriteCond %{ENV:WasHTML} ^yes$
RewriteRule ^(.*)$ $1.html
它工作正常。
但我的規則不起作用。
請幫我解決這個問題。
感謝, Srilu
什麼是你想用你的重寫規則呢? – 2011-06-14 14:53:30
似乎很奇怪,只有當URL已經具有相同格式的QueryString時,纔會要求重寫爲content.html?id =&gid = ?xxx- -yyy- ?zzz你有沒有嘗試刪除RewriteCond?它似乎不屬於這裏。但也許你可以詳細一點。 –
2011-06-16 00:36:04