【问题标题】:Using web.config file for redirect使用 web.config 文件进行重定向
【发布时间】:2014-06-27 18:44:27
【问题描述】:

仅使用 web.config 文件,我需要从一个域重定向到另一个域,并且我还需要将我网站中的每个单独页面(共有 25 个)重定向到新域下的相应页面。而重命名的/index.htm页面,也就是首页(和域名一样),也就是/ghostwriter.htm,需要重定向到对应的页面,也就是新的首页。

因此:http://www.rainbowriting.com/http://www.rainbowriting.com/ghostwriter.htm 是同一页面(索引页面)。

【问题讨论】:

    标签: web-config


    【解决方案1】:

    您需要确保 ASP.NET 正在处理 .htm 文件(在 IIS 中设置)。然后配置web.config

    <configuration>
      <location path="oldPage1.htm">
        <system.webServer>
          <httpRedirect enabled="true" destination="http://www.newDomain.com/newPage1.htm" httpResponseStatus="Permanent" />
        </system.webServer>
      </location>
      <location path="oldPage2.htm">
        <system.webServer>
          <httpRedirect enabled="true" destination="http://www.newDomain.com/newPage2.htm" httpResponseStatus="Permanent" />
        </system.webServer>
      </location>
      <!-- etc. -->
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 2015-10-08
      • 2017-12-04
      • 1970-01-01
      • 2017-12-04
      • 1970-01-01
      • 2012-05-11
      • 2019-03-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多