【发布时间】:2020-04-24 06:46:16
【问题描述】:
我的 web.config 中有一个 URL 重写。重写指令旨在做两件事:
- 如果 URL 引用的是实际文件(例如 css 文件或图像),请不要重写
- 如果 URL 不引用实际文件,则重写为 index.php?request={R:1}
案例 2 完美运行。但是,如果请求的文件存在,我会收到一个通用的 IIS 响应,指示错误:HTTP Error 500.50 - URL Rewrite Module Error. - 没有其他详细信息。错误代码只是表示通用重写模块错误。
我做错了什么?这是 IIS 10.0
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Do not rewrite existing files and folders" enabled="true" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" />
</conditions>
<action type="None" url="{R:0}" appendQueryString="true" logRewrittenUrl="true" />
</rule>
<rule name="Framework Parsing" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="index.php?request={R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
<caching>
<profiles>
<remove extension=".php" />
</profiles>
</caching>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<add name="Access-Control-Allow-Origin" value="*" />
<add name="X-Content-Type-Options" value="nosniff" />
<add name="X-Xss-Protection" value="1; mode=block" />
<add name="X-Frame-Options" value="SAMEORIGIN" />
<add name="Referrer-Policy" value="origin" />
</customHeaders>
</httpProtocol>
<!-- staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="8.00:00:00" setEtag="true" />
</staticContent -->
</system.webServer>
</configuration>
这是错误页面详情:
Module RewriteModule
Notification BeginRequest
Handler StaticFile
Error Code 0x80070005
Requested URL XXXXXXXXX/css/foundation/foundation.min.css
Physical Path XXXXXXXXX\public\css\foundation\foundation.min.css
Logon Method Not yet determined
Logon User Not yet determined
【问题讨论】:
标签: iis url-rewrite-module iis-10