Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: 301 redirect many files to one?
02-25-2013, 04:45 PM #1
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/
Redirect 301 (/page3|/page2|page1) /newpage/Need a way to drive traffic to your new site?
==> Check out HelpMyHits.com!
02-25-2013, 11:42 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
Not sure about the redirect since I don't think I've ever used it. But I'd expect rewrite would do it:
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.Code:RewriteRule ^/page([0-9]+)/?$ newpage/ [L,QSA,R=301]
Otherwise, nothing stops you from using the | separator in the rule pattern to specify the individual pages.
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');