【问题标题】:URL Rewrite: Is my syntax of the rule wrongURL 重写:我的规则语法是否错误
【发布时间】:2014-08-14 02:31:22
【问题描述】:

您好,我正在使用 Smartasp,我允许我进行 url 重写。我在 web.config 上设置了这样的规则:

<system.webServer>
        <rewrite>
            <rules>
                <rule name="AmazonS3" stopProcessing="true">
                    <match url="http://www.blah/amazon/(.*)" />
                    <action type="Redirect" url="http://amazon.blah/{R:1}" logRewrittenUrl="true" redirectType="Permanent" />
                </rule>
                <rule name="AmazonS3 with port" stopProcessing="true">
                    <match url="http://www.blah.com:80/amazon/(.*)" />
                    <action type="Redirect" url="http://amazon.blah.com/{R:1}" logRewrittenUrl="true" redirectType="Permanent"/>
                </rule>

我尝试阅读请求的网址:www.blah.com/amazon/ 到 amazon.blah.com。输入 www.blah.com/amazon/ 后,浏览器没有重定向到亚马逊页面...

在我输入规则的本地计算机上,在 system.webserver 下有一个重写标记突出显示无效重写。我错过了什么吗?

【问题讨论】:

    标签: asp.net url url-rewriting


    【解决方案1】:

    http试试这个方法:

    <rule name="Page Redirect" stopProcessing="true">
      <match url="www.blah.com/amazon/"/>
      <action type="Redirect" url="http://amazon.blah.com" redirectType="Permanent"/>
    </rule>
    

    【讨论】:

    • 我已经添加了你提到的规则,但仍然没有去
    • 将 url-match 更改为与此 &lt;match url="/amazon"/&gt; 完全相同并检查结果。
    • 不,我没有先使用本地主机尝试。如果我选择不匹配模式选项,它可以,但这个选项不是我想要的。
    • 抱歉不知道为什么它现在可以工作...我基本上清除了历史来测试它...酷,我可以伪造图像由我的网站托管的浏览器,但实际上它在亚马逊 s3 上。
    • 该死的 url 重写但无法伪造浏览器关于画布上的跨源
    猜你喜欢
    • 2013-11-02
    • 1970-01-01
    • 2013-11-24
    • 1970-01-01
    • 1970-01-01
    • 2018-11-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多