【问题标题】:Page redirect on an IIS serverIIS 服务器上的页面重定向
【发布时间】:2017-10-25 07:39:57
【问题描述】:

对不起,如果我完全困惑并在这里吠叫错误的树!

我知道在 Apache 服务器上我可以设置一个 .htaccess 文件并使用 Redirect 来将特定的 url 重定向到特定的新 url

Redirect /olddirectory/oldfile.html /newdirectory/newfile.html

IIS 服务器是否有类似的功能/能力?我对 IIS 和 asp.net 以外的设置了解不多,但我试图为 IT 人员指出正确的方向,即:不使用元刷新/重定向!如果需要,我可以找到更多信息。

【问题讨论】:

    标签: redirect iis


    【解决方案1】:

    您需要按照以下步骤操作:

    1) 如果未安装 IIS URL 重写模块到您的服务器,请安装 https://www.iis.net/downloads/microsoft/url-rewrite

    2) 在您网站的 web.config 中添加此规则:

    <rule name="redirect1" enabled="true" stopProcessing="true">
      <match url="olddirectory/oldfile.html" />
      <action type="Redirect" url="/newdirectory/newfile.html" />
    </rule>
    

    然后您将收到从/olddirectory/oldfile.html/newdirectory/newfile.html 的重定向

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-04
      • 2016-04-17
      • 1970-01-01
      • 1970-01-01
      • 2016-12-21
      • 2017-04-12
      • 1970-01-01
      相关资源
      最近更新 更多