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â¦
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 🙂
You are using incorrect regex in
category/fitness/*?
.Try this rule: