iis - 如何将 web.config 配置为 301 将所有 index.php 请求重定向到默认主页?
问题描述
我在运行 IIS 的 Windows 服务器上有客户的网站。我的一些客户以前的网站已编入索引,其中包括 index.php/varying_path_parameters
我想弄清楚的是如何修改 web.config 文件,以便对 index.php 文件的任何请求都重定向到主域。我有一个重定向来向任何 url 添加一个斜杠,但我不知道如何修改它以定位任何包含 .php 的请求
对 www.abc.com/index.php/someDir/ 的请求也是如此,我想将其重定向到 www.abc.com(不带斜杠)
如上所述,我已经有一个 web.config 文件,只是不确定如何重定向到主域
<rule name="Add trailing slash" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}/" />
</rule>
我只是希望将所有 .php 请求重定向到主域(请注意,我无法将 https : // 添加到消息中的 url,但我需要将其重定向到那里。
解决方案
推荐阅读
- visual-studio - 强制 VS 使用较低版本的程序集
- r - 更改 geom_bar 中条形的颜色
- python - Pandas:如何跟踪两个数据帧之间匹配数据条目的索引?
- scala - 如何使用 TypeTag 创建通用构建器?
- python - 在 PBS 中运行 tensorflow 作业之前,我需要检查哪些关键功能?
- apache - Apache设置反向代理后,默认主页无效
- python - 使用布尔运算符在 Z3 中定义约束
- html - Chrome OffscreenCanvas 自定义字体
- c - 将字符串与 libusb 一起使用会导致分段错误
- javascript - 生成 PBKDF2 密钥失败