301 在IIS 6上从web.config重定向。

问题描述 投票:1回答:1

我需要在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.commydomain2.com. 例子.............................................................................................................................................................................................................................................. mydomain1.comsomename 应转到 mydomain.comsomeothername 如何才能做到这一点?

在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 ---重定向根的代码。

asp.net redirect web-config iis-6 http-status-code-301
1个回答
0
投票

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

重写http转址 指令只能使用相同或IIS7之后的指令。

但你可以使用 ISAP方式与付费解决方案.

所以,我想 Response.Redirect("direct to");是最好的办法

© www.soinside.com 2019 - 2024. All rights reserved.