Forum Moderators: phranque

Message Too Old, No Replies

Where is the best place to 301?

Would it be better to 301 in the .htaccess file or in the httpd.conf file?

         

Propools

10:40 pm on Jun 8, 2010 (gmt 0)

10+ Year Member



Would it be better to 301 in the .htaccess file or in the httpd.conf file?
And Why?

AnkitMaheshwari

6:29 am on Jun 9, 2010 (gmt 0)

10+ Year Member



IMO, setting the redirect in httpd.conf is better as .htaccess is read on every request thus increasing the load time.

jdMorgan

5:20 pm on Jun 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you put any internal rewrites into httpd.conf (or any other server-config file), then DO NOT put any external redirects into .htaccess. You don't want the situation where the filepath of an internal URL-to-filepath rewrite executed earlier in a config file can be 'exposed' to a client by a later redirect in that config file or in a later-executed .htaccess file.

In general, put as much of the server config code as possible into the config files. The 'source code' in these config files is 'compiled' to native executable code at server start-up, and executes much, much faster that the same code in .htaccess, which must be 'interpreted' from text for each and every HTTP request to the server.

Jim