我有一个IIS的web.config,如果没有定义的页面(即index.php),它可以部分地将请求重写到另一个本地wwwroot文件夹。
所以像:www.blah.net/something/index.php这样的url会显示一个正确的页面。但是,www.blah.net/something/重写另一个URL并忽略该目录中的index.php。
<configuration>
<system.webServer>
<defaultDocument enabled="true" />
<rewrite>
<rules>
<rule name="RewriteAll" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="_h5ai/public/index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<caching enabled="false" enableKernelCache="true" />
</system.webServer>
</configuration>发布于 2020-07-07 09:27:04
非常简单,只需添加一个条件来检查文件是否存在。
<conditions>
<add input="{Document_Root}/{REQUEST_URI}/index.php" matchType="IsFile" negate="true" />
</conditions>此外,在清除本地浏览器缓存后或在浏览器的隐藏窗口中验证结果。
如果问题仍然存在,请随时通知我。
发布于 2020-07-06 16:33:37
我认为您需要告诉IIS您的默认文档是什么。更换线路
<defaultDocument enabled="true" />使用
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.htm" />
<add value="default.php" />
<add value="default.htm" />
</files>
</defaultDocument>IIS将按照列出的顺序检查默认文档部分中列出的所有文件名,您可以使用任意数量的文件名。<clear />行告诉IIS忽略标准服务器设置。(如果不指定任何默认文件,它将查找“Default.htm”、“Default.aspx”和“Default.asp”(我认为)。)
https://stackoverflow.com/questions/62731370
复制相似问题