RewriteRule not working for WordPress category

I’m trying to write a RewriteRule for redirecting traffic after I have changed the name of some categories in WordPress.

The old URL looked like this…

Read More
http://www.example.com/category/fitness/

I want it to redirect to…

http://www.example.com/category/health-and-lifestyle/

I can get it to work using the following rule, but it only ever rewrites the main category, and doesn’t do the same for paginated pages .i.e fitness/page/2/, fitness/page/3/ etc

RewriteRule category/fitness/*? category/health-and-lifestyle/ [R=301,L]

Can anyone help me get this working so that it makes the following…

http://www.example.com/category/fitness/
http://www.example.com/category/fitness/page/2/
http://www.example.com/category/fitness/page/3/

rewrite to…

http://www.example.com/category/health-and-lifestyle/
http://www.example.com/category/health-and-lifestyle/page/2/
http://www.example.com/category/health-and-lifestyle/page/3/

Thanks a lot 🙂

Related posts

Leave a Reply

1 comment

  1. You are using incorrect regex in category/fitness/*?.

    Try this rule:

    RewriteRule ^category/fitness/(.*)$ category/health-and-lifestyle/$1 [R=301,L,NC]