Php .htaccess将Wordpress类别重写到第页
我的URL结构有点问题,因为我使用的是我的Wordpress页面的自定义结构 目前我使用普通页面作为分类Php .htaccess将Wordpress类别重写到第页,php,wordpress,apache,.htaccess,Php,Wordpress,Apache,.htaccess,我的URL结构有点问题,因为我使用的是我的Wordpress页面的自定义结构 目前我使用普通页面作为分类 www.domain.tld/my_page 此页面包含普通Wordpress类别中的所有帖子。页面由插件自动生成。我的问题是当我使用面包屑时,当我进入帖子时,我会看到下面的面包屑 Home > Category > Post 这应该是 Home > Category > Post (where category should link to my_page in
www.domain.tld/my_page
此页面包含普通Wordpress类别中的所有帖子。页面由插件自动生成。我的问题是当我使用面包屑时,当我进入帖子时,我会看到下面的面包屑
Home > Category > Post
这应该是
Home > Category > Post (where category should link to my_page instead of category)
我可以用.htaccess中的普通rewritetrule来管理它,如下所示:
RewriteRule ^category/name_of_category/ http://domain.tld/name_of_category/ [R=301,L]
是否可以在.htaccess中进行重写,将/category/完全从URL结构中删除?这将使我的结构正常工作,无需每次添加新类别时都在.htaccess中添加新规则
希望有人能帮忙。函数kill\u category\u base($string){
$string=str_replace('category/',''$string);
返回$string;
}
添加过滤器('category_link'、'kill_category_base');
RewriteRule^([^/]+)/(页面/([0-9]+)|提要)$index.php/category/$1/$2[L]#重定向类别页面和提要
在这里找到谢谢。正是我所需要的:)