【发布时间】:2023-03-07 00:16:02
【问题描述】:
我将 wordpress 安装在主根文件夹中名为“blog”的子目录中,并在根文件夹中使用 .php 扩展名重写了 web.config URL。我在“博客”子目录中也有标准的 wordpress web.config 文件。
除了某些原因登录页面在登录时不断刷新,这让我相信存在冲突之外,所有工作正常。
会省略根 web.config 帮助中的“博客”目录吗?我试过了,但我收到的只是 500 个错误。
这里是根 web.config...
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect .php extension" stopProcessing="false">
<match url="^(.*).php$" ignoreCase="true" />
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="(.*).php$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
</rule>
<rule name="hide .php extension" stopProcessing="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}.php" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="{R:0}.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
这里是 blog/web.config...
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" 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>
</configuration>
非常感谢任何想法。
【问题讨论】:
标签: php wordpress iis url-rewriting