【问题标题】:wordpress url rewriting in asp.net website not work for categories and tagsasp.net网站中的wordpress url重写不适用于类别和标签
【发布时间】:2015-02-12 06:11:04
【问题描述】:

我在我的 asp.net 网站中使用 wordpress 引擎来写博客。
我在设置中使用像 /posts/%post_id%/ 这样的 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>

【问题讨论】:

  • 我正在使用带有 iis 7 的 windows server 2008 并且网站是波斯语

标签: php asp.net wordpress


【解决方案1】:

这是解决方案:
在 wp-config.php 文件中添加以下代码:

if (isset($_SERVER['UNENCODED_URL']))
     $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-23
    • 2015-10-25
    • 1970-01-01
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    相关资源
    最近更新 更多