301 Redirect to a new site


#1

I am combining a site with 1,700 pages to a new site. I want to redirect specific pages. i.e. /pictures/1.php /celebrity-pictures/whoever.php

Should all the redirects be put into the .htaccess in the root directory of the site? Would it be more beneficial to have /.htaccess and /pictures/.htaccess , etc? Thank you for any help you can provide.


#2

Like so many other questions, this one has the frustrating answer of “it depends.” As you’ll likely suspect it takes more webserver processing power to parse through a larger .htaccess file. Apache will look in the directory being browsed for an .htaccess file and will traverse up the directory structure until it finds one, stopping at the first one it locates.

I notice you have php extensions on your file names. Do you have other stuff in an existing .htaccess file? Examples would be blacklisted IP addresses and referrers. If so, placing 301 redirects in subdirectories will effectively bypass those other instructions unless you duplicate them in all .htaccess files.

Unless you have a whole lot of general configuration details in a top level .htaccess I recommend putting smaller ones in logical subdirectories. You wouldn’t have to generate them for every single directory, but you’ll want to try and keep the number of evaluations to a comfortable level. I don’t have any data in front of me but 1700 seems like quite a few. I am going to throw out an arbitrary number and say that I wouldn’t recommend more than a couple hundred per .htaccess file at most, and even that number seems a little high to me.


#3

Thank you very much for your reply. I believe, as you advised and through some digging on google that it would be best to put the .htaccess in logical directories.

Again i really appreciate your help in this area.