IIS7 重写规则不起作用
我创建了一条这样的规则:
<rewrite>
<rules>
<rule name="ImageRedirect" stopProcessing="false">
<match url="^(.*)/(.*)/" />
<action type="Rewrite" url="http://www.lrgimages.com/ImageRewrite.aspx?=img={R:2}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
我不断收到 404.0 消息,就像规则不起作用或 IIS 没有接收到它一样。在规则的测试模式部分,模式测试良好。如果我直接转到 http://www.lrgimages.com/ImageRewrite.aspx 该页面加载,但当我尝试时却没有加载: http://www.lrgimages.com/TestImage
有什么想法吗?
更新:我想通了。重写 URL 时,它不会考虑 http://www.DomainName.com 。重定向以这种方式工作,因为 htat 才是真正在做的事情。我习惯了其他重写引擎不考虑 http://www.DomainName.com 。感谢大家引导我走向正确的方向。
I have created a this rule:
<rewrite>
<rules>
<rule name="ImageRedirect" stopProcessing="false">
<match url="^(.*)/(.*)/" />
<action type="Rewrite" url="http://www.lrgimages.com/ImageRewrite.aspx?=img={R:2}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
I keep getting a 404.0 message like the rule is not working or IIS is not picking it up. In the test parttern section for the rule, the pattern tests fine. If I go directly to the http://www.lrgimages.com/ImageRewrite.aspx that page loades, but not when I try: http://www.lrgimages.com/TestImage
any thoughts?
Update: I figured it out. It does not take into acount hte http://www.DomainName.com when rewriting a url. Redirects work this way since htat is what is is really doing. I am used to other rewrite engines not taking into account the http://www.DomainName.com . Thanks all you lead me in the right direction.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为“/TestImage”匹配
^(.*)/(.*)/
...I don't think "/TestImage" matches
^(.*)/(.*)/
...