【问题标题】:301 redirect on IIS?IIS上的301重定向?
【发布时间】:2012-12-14 08:36:53
【问题描述】:

我有两个网站,例如“testsite.ir”和“testsite.com”。据我所知,我的网站位于 Windows Server 2008、Microsoft-IIS/7.5 上。 如何使用 301 重定向将用户从 .ir 重定向到 .com? 我可以使用 .htaccess 文件还是应该使用 webconfig?

我在我的 webconfig 中使用下面的代码,但没有任何反应:

  <rule name="Redirect from ir to com" stopProcessing="true">
    <match url=".*" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^www\.testsite\.ir$" />
    </conditions>
    <action type="Redirect" url="http://www.testsite.com/{R:0}" />
    </rule>

任何帮助将不胜感激!

【问题讨论】:

    标签: asp.net .net iis redirect web


    【解决方案1】:

    如果您可以远程访问服务器,则可以在 IIS 中执行此操作。您需要在 IIS 中启用 HTTP 重定向(添加/删除 Windows 功能),然后才能添加规则。启用后,您可以将 .ir 站点重定向到 .com 站点。见这里:http://www.iis.net/configreference/system.webserver/httpredirect

    【讨论】:

      猜你喜欢
      • 2019-05-30
      • 2010-12-09
      • 2012-02-20
      • 2011-08-24
      • 2013-02-06
      • 2016-01-27
      • 1970-01-01
      • 1970-01-01
      • 2017-05-31
      相关资源
      最近更新 更多