【问题标题】:Web.config httpRedirect wildcard folder and index.aspxWeb.config httpRedirect 通配符文件夹和 index.aspx
【发布时间】:2016-06-20 09:54:29
【问题描述】:

我正在尝试将 /company/ 中的任何页面(包括根 /company/ 本身)重定向到另一个页面。

这是我目前得到的:

 <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Permanent">
  <add wildcard="*/company/*" destination="/another/page/" />
</httpRedirect>

这可行,但是它具有重定向路径中包含 /company/ 的任何其他文件(图像、脚本等)的副作用。

我可以强制它只重定向 .aspx 文件,但它不会重定向根文件夹 /company/

<add wildcard="*/company/*.aspx" destination="/another/page/" />

如何使用 IIS httpRedirect 模块 做到这一点?

有很多使用 IIS URL 重写模块的重定向示例,但不幸的是我无法在实时服务器上安装该模块。

【问题讨论】:

    标签: redirect iis


    【解决方案1】:

    您可以尝试在通配符属性上添加完整路径,如下所示:

    <add wildcard="your-full-path/company/*" destination="/another/page/" />
    

    并为所有需要此规则的根文件夹附加多个“添加”节点

    【讨论】:

      猜你喜欢
      • 2013-02-27
      • 1970-01-01
      • 2013-08-12
      • 1970-01-01
      • 2020-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多