繁体   English   中英

301 从 IIS 6 上的 web.config 重定向

[英]301 Redirect from web.config on IIS 6

我需要从 IIS 6 服务器(Windows 2003 Web 服务器)上的 web.config 进行 301 重定向。 我是一个 Apache 服务器人,对 Windows Web 服务器一无所知。 我只能从 FTP 访问服务器。

我在另一个问题中发现了以下内容,但它似乎不起作用:

<system.webServer>
    <rewrite>
        <rules>
        <rule name="Redirect to WWW" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^mydomain1.com$" />
          </conditions>
          <action type="Redirect" url="http://www.mydomain2.com"
               redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
</system.webServer>

我需要将单独的页面从mydomain1.com重定向到mydomain2.com
前任。 mydomain1.com/somename应该重定向到mydomain.com/someothername

如何才能做到这一点?

- - 编辑 - -
在 stackoverflow 上看到另一个线程后,我的配置现在看起来像这样:

<system.webServer>
    <rewrite>
        <rule name="rule1">
            <match url="default.aspx"/>
            <action type="Redirect" redirectType="Permanent" url="http://www.mydomain.com/somename/somename.aspx"/>
        </rule>
        <rule name="rule2">
            <match url="somename.aspx"/>
            <action type="Redirect" redirectType="Permanent" url="http://www.mydomain2.com/somename2/somename2.aspx"/>
        </rule>
    </rewrite>
</system.webserver><br>

--- 编辑 2 ----重定向根的代码:

据我调查,在 IIS6 上无法通过 web.config 重定向。

rewritehttpRedirect指令只能在 IIS7 相同或之后使用。

但是您可以将ISAP 方式与付费解决方案一起使用

所以,我认为Response.Redirect("direct to"); 是最好的方法

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM