Reputation: 21
I'm migrating a site so I need to redirect all content from a www.oldurl.com/subfolder to the www.newurl.com and keep all the links, for example:
www.oldurl.com/subfolder/subfolder2
needs to redirect to
www.newurl.com/subfolder2
AND
www.oldurl.com/subfolder/subfolder3/link.html
needs to redirect to
www.newurl.com/subfolder3/link.html
my .htacess looks like this:
RewriteEngine on
RewriteRule ^subfolder/(.*)$ /$1 [R=301,L]
It is redirecting all www.oldurl.com/subfolder to www.newurl.com/ but does not follow the old paths it just sends all request to home page
Upvotes: 1
Views: 1125
Reputation: 26153
For new conditions new .htaccess
RewriteEngine on
RewriteRule ^subfolder/(.*)$ http://www.newurl.com/$1 [R=301,L]
Upvotes: 1