||02-25-2013 04:45 PM
301 redirect many files to one?
Hi guys, l'm trying to use htaccess to 301 redirect a bunch of old pages to a newly improved page. -- l have a lot of them and l was wondering if there was a cleaner way of doing this?
Redirect 301 /page1/ /newpage/
Redirect 301 /page1 /newpage/
Redirect 301 /page2/ /newpage/
Redirect 301 /page2 /newpage/
Redirect 301 /page3/ /newpage/
Redirect 301 /page3 /newpage/
Is there something like this l can do?
Redirect 301 (/page3|/page2|page1) /newpage/
Another point to mention, l have each URL listed twice, because it doesn't seem to work because of the trailing slash on the old page -- sometimes it's there for visitors sometimes it's not.
||02-25-2013 11:42 PM
Not sure about the redirect since I don't think I've ever used it. But I'd expect rewrite would do it:
RewriteRule ^/page([0-9]+)/?$ newpage/ [L,QSA,R=301]
Something like that maybe (untested, don't know if it'll work)? Only really useful if the pages are actually named pagex where x is any number.
Otherwise, nothing stops you from using the | separator in the rule pattern to specify the individual pages.
|All times are GMT +1. The time now is 05:34 PM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.