Reputation: 11
I'm rebuilding a site and have a big list of category url's which have to be redirected to a new category url.
Old url: http://www.example.com/channels/5/category1/
New url: http://www.example.com/categories/category1/
How to accomplish this with an htaccess 301 redirect?
Upvotes: 1
Views: 136
Reputation: 784898
You can use this single 301 redirect rule as your first rule in site root .htaccess:
RedirectMatch 301 ^/channels/[0-9]+/(.+)$ /categories/$1
Upvotes: 0
Reputation: 7476
Try below rule,
RewriteEngine On
RewriteCond %{REQUEST_URI} $channels/5/([\w-]+)/$
RewriteRule ^ example.com/categories/%1/ [R=301,L]
Upvotes: 0