我在 iis 服务器上使用 wordpress wirh 永久链接结构 (/%year%/%monthnum%/%day%/%postname%/)。
问题在于非拉丁字符,如马拉雅拉姆语。
我写的web.config如下,
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" relaxedUrlToFileSystemMapping="true" AllowRestrictedChars="1" UrlSegmentMaxLength="2048" />
<pages validateRequest="false" />
</system.web>
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true" />
</security>
<rewrite>
<rules>
<rule name="WordPress Rule" stopProcessing="true" >
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?page={R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
帖子页面转到日期存档。如何解决这个问题?
最佳答案
只需将下面的代码添加到您网站根目录下的 index.php
文件中:
if (isset($_SERVER['UNENCODED_URL'])) {
$_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
}
您的 web.config
需要像这样:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress: http://yoursite" 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>
关于wordpress - 如何使用非拉丁 url 在 iis 上为 wordpress 编写 web.config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24280940/