本文介绍了删除“页面”来自分页网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在更改Wordpress中的分页URL时遇到问题。我知道针对此问题的通用解决方案是更改Wordpress核心文件,但是我只需要针对一个类别的此解决方案。

I have problem with changing pagination URL in Wordpress. I know that universal solution for this is to changing Wordpress core files, but I need this solution only for one category. Maybe for only one category this can be done by htaccess?

现在可能是这样的URL:
页面 / 3

There is now URL like this:http://mysite.com/categoryname/page/3

我想将其更改为:

感谢您的任何答复

推荐答案

您需要将%{THE_REQUEST} 以确保您与实际请求匹配,而不是内部重写的URI:

You need to match against the %{THE_REQUEST} to ensure that you're matching against the actual request and not an internally rewritten URI:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /categoryname/page/([0-9]+)
RewriteRule ^ /categoryname/%1 [L,R=301]

RewriteRule ^/categoryname/([0-9]+)$ /categoryname/page/$1 [L]

这些必须在wordpress规则之前。

These have to be before the wordpress rules.

这篇关于删除“页面”来自分页网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 06:52