首页 > 解决方案 > WordPress 阻止 add_rewrite_rule 重定向

问题描述

在 WordPress 网站上,我想要来自的内容

http://thesite.com/cars显示 http://thesite.com/cars/index 中的内容

我正在尝试使用以下重写规则来做到这一点:

add_rewrite_rule(
  'cars/?$',
  'index.php?page_type=cars&name=index',
  'top');

它可以工作,只是它重定向到http://thesite.com/cars/index

有什么方法可以防止重定向发生吗?

标签: phpwordpressurl-rewriting

解决方案


推荐阅读