Reputation: 134
I converted a Drupal site to WordPress and am using the Redirection plugin to redirect the old page hierarchy to the new one.
I need to get example.com/page/slug to go to example.com/slug. I used /page/(.*), but that breaks the pagination in WordPress since it uses /category/category-name/page/2 for it's hierarchy. I get urls like example.com/category/category-name/2 instead.
What's the RegEx I need to get both the pagination and the URL redirects to work correctly?
Upvotes: 0
Views: 819
Reputation: 21269
Assuming mod_rewrite
syntax, anchor your regex:
^page/(.*)
... this way the category/category-name/page/2
would not match anymore.
NB: to my knowledge a leading slash is not necessary when matching URIs with mod_rewrite
.
Upvotes: 1