我在asp.net网站上使用wordpress引擎写博客
我在设置中使用类似/posts/%post_id%/的url重写。除了类别和标签之外,所有东西都正常工作
我将基本类别设置为"类别",将基本标记设置为"标记"。分类URL看起来像"/blog/category/(something)/",但它引发了404错误
Wordpress web.config如下所示:
<rewrite>
<rules>
<rule name="Main 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" />
</rule>
</rules>
这就是解决方案:
在wp-config.php文件中添加以下代码:
if (isset($_SERVER['UNENCODED_URL']))
$_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];