简体   繁体   English

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

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

I need to make an 301 Redirect from the web.config on a IIS 6 server (Windows 2003 Web Server).我需要从 IIS 6 服务器(Windows 2003 Web 服务器)上的 web.config 进行 301 重定向。 I'm a Apache-server guy, and do not have a clue about Windows Web Servers.我是一个 Apache 服务器人,对 Windows Web 服务器一无所知。 I only have access to the server from FTP.我只能从 FTP 访问服务器。

I have found the following in another question, but it does'nt seem to work:我在另一个问题中发现了以下内容,但它似乎不起作用:

<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>

I need to redirect seperate pages from mydomain1.com to mydomain2.com .我需要将单独的页面从mydomain1.com重定向到mydomain2.com
Ex.前任。 mydomain1.com/somename should redirect to mydomain.com/someothername mydomain1.com/somename应该重定向到mydomain.com/someothername

How can this be done?如何才能做到这一点?

---- Edit ---- - - 编辑 - -
After seeing another thread here on stackoverflow, my configuration now kind of looks like this:在 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>

--- Edit 2 ---- Code for redirecting the root: --- 编辑 2 ----重定向根的代码:

As far as I investigated, There is no way to redirect by web.config on IIS6.据我调查,在 IIS6 上无法通过 web.config 重定向。

rewrite and httpRedirect directives can use only same or after IIS7. rewritehttpRedirect指令只能在 IIS7 相同或之后使用。

But you can use ISAP way with paid solution .但是您可以将ISAP 方式与付费解决方案一起使用

So, I think Response.Redirect("direct to");所以,我认为Response.Redirect("direct to"); is best way是最好的方法

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

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