我正在使用Isapi重寫3(mod重寫克隆爲IIS),並嘗試重寫基於查詢字符串的URL - 然後在重寫中傳遞該查詢字符串的一部分。Isapi重寫 - 訪問查詢字符串模式匹配RewriteRule
所以,如果我輸入一個URL是這樣的:/test/home.cfm?page=default & arbitraryExtraArg = 123
我想,要被改寫爲:/test/index.cfm?page =家庭& arbitraryExtraArg = 123
我有以下條件/規則:
RewriteCond %{QUERY_STRING} ^page=default(.*)$ [I]
RewriteRule ^/test/home.cfm$ /test/index.cfm?page=home%1 [I,R=301]
但額外的查詢字符串variabl es永遠不會通過。 %1似乎是空白的。
這是如何引用來自RewriteCond的模式匹配,對吧?
缺少什麼我在這裏?
謝謝!
編輯:它看起來像我RewriteCond被完全忽略。這裏是我的日誌文件看起來像:
[snip] (2) init rewrite engine with requested uri /test/home.cfm?page=default
[snip] (1) Htaccess process request C:\Inetpub\wwwroot\dev\IsapiRewrite\httpd.conf
[snip] (3) applying pattern '^/test/home\.cfm$' to uri '/test/home.cfm'
[snip] (1) escaping /test/index.cfm?page=home
[snip] (2) explicitly forcing redirect with http://www.devsite.com/test/index.cfm?page=home
[snip] (2) internal redirect with /test/home.cfm?page=default [INTERNAL REDIRECT]
[snip] (2) init rewrite engine with requested uri /test/index.cfm?page=home
[snip] (1) Htaccess process request C:\Inetpub\wwwroot\dev\IsapiRewrite\httpd.conf
[snip] (3) applying pattern '^/test/home\.cfm$' to uri '/test/index.cfm'
如果有在那裏的RewriteCond模式檢查的提?
但是該規則是否適用? – Gumbo 2009-07-07 14:14:47
是的,確切地說。我最終在/test/index.cfm?page=home – stubotnik 2009-07-07 14:18:13
那麼`/test/home.cfm?page = default`的初始請求呢?或者,你是否一直在測試`/test/index.cfm?page = home`?如果是這樣,您可能會誤解URL重寫的工作方式。他們只是重寫請求的URI! – Gumbo 2009-07-07 16:34:11