IIS7 重写规则不起作用

发布于 2024-10-01 13:19:46 字数 978 浏览 0 评论 0原文

我创建了一条这样的规则:

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我纯我任性 2024-10-08 13:19:46

我不认为“/TestImage”匹配 ^(.*)/(.*)/ ...

I don't think "/TestImage" matches ^(.*)/(.*)/ ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文