Wordpress页面重写URL无效

时间:2013-08-28 13:08:01

标签: wordpress url-rewriting

我想寻求解决这个问题的方法。目前我设置了一个带有子页面的页面,这些子页面将用作每个子页面的自定义post_type。

新闻

  • 事件
  • 文章
  • 新闻稿

在这个页面上我添加了一个自定义重写URL,这样我就可以为归档页面添加一个自定义URL,这是我在事件中作为示例所做的代码

add_rewrite_rule('news/events/archive/([0-9]{4})/?$', 'index.php?pagename=events&yyyy=$matches[1]','top');
add_rewrite_rule('news/events/archive/([0-9]{4})/([0-9]{1,2})/?$', 'index.php?pagename=events&mm=$matches[2]&yyyy=$matches[1]','top');

但问题是如果我访问此网址,例如, www.site.com/news/events/archive/2013/ 它将我重定向回页面网址 www.site.com/news/events /

有什么解决方案可以解决我的问题吗?

TIA,谢谢

0 个答案:

没有答案
相关问题