【问题标题】:redirect with web.config exclude robots.txt使用 web.config 重定向排除 robots.txt
【发布时间】:2018-04-09 03:38:03
【问题描述】:

我试着这样做:

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Redirect to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                        <add input="{REQUEST_URI}" negate="true" pattern="^/robots\.txt$" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

但它没有用......我做错了什么?

【问题讨论】:

  • 如果您能对您的问题提供适当的描述,那就太好了。

标签: redirect iis web-config


【解决方案1】:

您的规则是正确的,很可能您的浏览器缓存了 301 重定向。能否请您清除浏览器的缓存并尝试访问robots.txt

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-08
    • 2012-08-09
    • 2019-03-25
    • 2014-09-27
    • 2015-04-19
    • 2012-09-06
    相关资源
    最近更新 更多