Forum Moderators: phranque

Message Too Old, No Replies

Best Placement of redirects root or sub

should i be putting the redirects in the sub-folders rather than root folde

         

nigelt74

12:29 am on Oct 4, 2007 (gmt 0)

10+ Year Member



I have been given a project to do adding redirects for a rather massive site, the redirects are going to number in the hundreds if not thousands (even using the knowledge I have picked up here)

I am assuming that if i put the redirects into .htaccess files within the subfolders that will cut down the server load and make response times quicker than putting all the redirects in the root .htaccess file

The site has about 20 main subfolders (those coming off root) and i was thinking of sticking a .htaccess in each of them containing the relevant redirects, is it a good idea, as to my mind doing it this way means that the server won't have to look through as many redirects when a request is made

jdMorgan

12:40 am on Oct 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As with everything, it's a trade-off; Better performance if the code is split among the subdirectories, easier administration if they're centralized to the root directory.

There's another option too, possibly: Put the code into httpd.conf or conf.d, where it will be compiled at server startup, rather than being interpreted from source for each and every HTTP request. If you pay attemtion to other details such as putting the redirects in order from most-requested to least and using the [L] flag on RewriteRules, you might actually see a large performance improvement by placing the code at the server config level, despite having all those directives in one location.

Jim