Reputation: 655
I'm changing the URL structure on a site and need to set a 301 to force users to the new URL.
I want to go from:
http://website.com/blog/single/name-of-entry
to:
http://website.com/blog/name-of-entry
I'd like to remove the segment single
.
I've been searching, but haven't found anything that's worked yet. I think I've gotten close with this code:
RewriteRule ^(.*?)/?single(.*)$ /$1$2 [L]
Any ideas?
Upvotes: 1
Views: 42
Reputation: 785266
You can use this rule in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteRule ^(.+?)/single/(.*)$ /$1/$2 [L,NC,R=301]
Upvotes: 1