IIS URL重写不使用查询字符串 [英] IIS URL Rewrite not working with query string
问题描述
我认为这很简单,但它拒绝工作。旧网址
I thought this was pretty straightforward, but it refuses to work. The old URL is
http:/ /www.site.com/?q=node/17
需要重定向到 http://www.site.com 。我不需要担心通配符,这是我唯一需要担心的查询字符串参数。我写的规则看起来像
It needs to redirect to http://www.site.com. I don't need to worry about wildcards, this is the only query string parameter I need to worry about. The rule I wrote looks like
<rule name="Node17" patternSyntax="ExactMatch" stopProcessing="true">
<match url="http://www.site.com/?q=node/17" />
<action type="Redirect" url="http://www.site.com" appendQueryString="False" />
</rule>
我可以测试IIS内部的模式并匹配,但是当我在浏览器中点击URL时它没有重定向。有什么想法吗?
I can test the pattern inside of IIS and it matches, but when I hit the URL in a browser it doesn't redirect. Any thoughts?
推荐答案
当然我在发布后很快发现了它。这样做,不确定为什么完全匹配不起作用。
Of course I figured it out soon after I posted. This does it, not really sure why the exactmatch wasn't working though.
<rule name="Node17" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{QUERY_STRING}" pattern="q=node/17" />
</conditions>
<action type="Redirect" url="http://www.site.com" appendQueryString="False" />
</rule>
这篇关于IIS URL重写不使用查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!