【问题标题】:wordpress url rewrite help needed需要wordpress url重写帮助
【发布时间】:2014-12-30 13:01:12
【问题描述】:

我有一个 wordpress 网站和模板页面。我将类 ID 作为 cid 参数传递。 http://www.example.com/class-details/?cid=51

我希望它像http://www.example.com/class-details/

我在 .htaccess 中写了下面的规则 RewriteRule ^class-details/?([^/]*)$ example.com/class-details/$1 [NC,R,L]

它导致递归重定向。我尝试了很多检查 wordpress 重定向 API。但没有运气。请指导我。

【问题讨论】:

标签: wordpress .htaccess url-rewriting


【解决方案1】:

最好创建自定义帖子类型,然后您不需要传递 cid 或任何东西,您将拥有 Rewrite URL。

【讨论】:

    【解决方案2】:

    试试这个

    <rule enabled="true" match-type="wildcard"> 
        <from casesensitive="true">/class-details/cid=([a-zA-Z0-9]+)$</from>
        <to type="passthrough">/class-details?cid=$1</to>
    </rule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多