在具有 + 的 IIS 中重写 URLS
Rewriting URLS in IIS having +
我有以下 URL - 网站。com/ABCDETest+PHP,每次我访问该网站时都会收到 404 - 找不到文件或目录。我的 web.config 是
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Test" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule>
</rules>
</rewrite>
</system.webServer>
有谁知道为什么我收到 404 页面并且它没有重定向到 index.php?
您可能收到 HTTP 错误 404.11 - 未找到
这不是因为规则不起作用,而是因为请求过滤模块拒绝请求的安全相关问题。
请求过滤模块配置为拒绝包含双转义序列的请求。
您必须执行以下操作
IIS 管理器 -> 查找网站 > 转到请求筛选 -> 编辑功能设置并启用设置 "Allow double escaping"。
我有以下 URL - 网站。com/ABCDETest+PHP,每次我访问该网站时都会收到 404 - 找不到文件或目录。我的 web.config 是
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Test" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule>
</rules>
</rewrite>
</system.webServer>
有谁知道为什么我收到 404 页面并且它没有重定向到 index.php?
您可能收到 HTTP 错误 404.11 - 未找到
这不是因为规则不起作用,而是因为请求过滤模块拒绝请求的安全相关问题。
请求过滤模块配置为拒绝包含双转义序列的请求。
您必须执行以下操作
IIS 管理器 -> 查找网站 > 转到请求筛选 -> 编辑功能设置并启用设置 "Allow double escaping"。