1000s of 301 redirects, ok to put all of them in one file?

New to mod_rewrite? This is a good place to start.

1000s of 301 redirects, ok to put all of them in one file?

Postby taurianthebull » Thu Sep 03, 2009 2:24 pm

Hello!
One of my client's site is just shifted from ASP to PHP, and everything has been changed. Filenames, etc...

There are like 5000+ links!

I need to know what would be the best way to do this? The google webmaster recognized all the links as broken which is affecting PR.

Do i have to put them all into a single .htaccess file?
Will this slowdown the site?

Please advice, thanks!
taurianthebull
 
Posts: 6
Joined: Thu Sep 03, 2009 2:15 pm

Postby richardk » Thu Sep 03, 2009 5:33 pm

Do i have to put them all into a single .htaccess file?

No. If the old URLs contain sub directories you could split them up in to the sub directories. If there a matchable patterns you can use [url=http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch]RedirectMatch[url] (or mod_rewrite). Or you could create a custom PHP 404 handler that searched an array or database.

Will this slowdown the site?

Probably, but it really depends on your server.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby taurianthebull » Thu Sep 03, 2009 6:11 pm

If i use a custom PHP 404 handler, will this still give google a 404 error? and will affect ranking?
taurianthebull
 
Posts: 6
Joined: Thu Sep 03, 2009 2:15 pm

Postby richardk » Sat Sep 05, 2009 8:04 am

No, you can send any HTTP Status Code with the PHP header() function. A 301 redirect
Code: Select all
header('Location: http://www.example.com/123', true, 301);
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby taurianthebull » Sat Sep 05, 2009 8:07 am

Thanks!!
taurianthebull
 
Posts: 6
Joined: Thu Sep 03, 2009 2:15 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 24 guests

cron