我正在使用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