How can I use htaccess to redirect paths with a wildcard character in wordpress

I recently changed my 92 category links and now I am getting hit with hundreds of 404 errors from Google because the old links are not found. I tried to use plugins to automatically redirect single URLS but I am noticing there are more and more coming in and doing everything on a 1 by 1 basis is not efficient.

I was hoping someone could assist me on getting my pages redirected using my htaccess file.

Read More

For Example Going to

example.com/category/old-category/

should redirect to

example.com/category/new-category/

More importantly I would like to redirect the page numbers of the old categories to the page numbers of the new categories using a wildcard. So page x of old category will redirect to page x of new category.

example.com/category/old-category/page/5/  

should redirect to

example.com/category/new-category/page/5/

Thanks in advance.

Related posts

1 comment

  1. You can use this generic redirect rule just below RewriteEngine line:

    RewriteRule ^(category)/old-category(/.*)? /$1/new-category/$2 [L,NC,R=301]
    

Comments are closed.