【问题标题】:Wordpress add_rewrite_rule working on Apache, not on IISWordpress add_rewrite_rule 在 Apache 上工作,而不是在 IIS 上
【发布时间】:2014-08-17 01:53:04
【问题描述】:

我有以下重写规则:

add_action( 'init', 'custom_rewrite_rules' );
function custom_rewrite_rules() {
    add_rewrite_rule('formation(/([^/]+))?(/([^/]+))?/?','index.php?pagename=formation&formation_slug=$matches[2]&formation_id=$matches[4]','top');
    add_rewrite_tag('%formation_slug%','([^&]+)');
    add_rewrite_tag('%formation_id%','([^&]+)');
}

这在我的 Apache 服务器上运行良好,而不是在我客户端的 IIS 上。 我刷新了重写规则,Monkeyman Rewrite Analyzer 插件告诉我重定向应该按计划工作。

对我所缺少的有什么建议吗?

非常感谢您的帮助

编辑:上!

【问题讨论】:

    标签: wordpress apache iis rewrite url-rewrite-module


    【解决方案1】:

    问题在于 IIS 不接受 URL 中的“+”字符 as explained here,而我使用 urlencode()urldecode() 来生成我的 URL。

    我实施的解决方法是将“+”替换为“--”。

    【讨论】:

      猜你喜欢
      • 2013-12-20
      • 2014-06-05
      • 1970-01-01
      • 1970-01-01
      • 2021-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-01
      相关资源
      最近更新 更多