Forum Moderators: phranque

Message Too Old, No Replies

difference between .htaccess and http.conf ...

         

sugath

8:10 pm on Oct 29, 2003 (gmt 0)

10+ Year Member



what is the difference between difference between .htaccess and httpd.conf ...
where are these files located and what are they used for ..

thanks

coopster

8:18 pm on Oct 29, 2003 (gmt 0)

sugath

8:38 pm on Oct 29, 2003 (gmt 0)

10+ Year Member



would u plz explain that to me in plain english ...

incywincy

9:35 pm on Oct 29, 2003 (gmt 0)

10+ Year Member



from what i understand httpd.conf is only read and presumably cached at apache start whereas .htaccess is read for every server request and is therefore more expensive cpu-wise but less disruptive.

jdMorgan

10:16 pm on Oct 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sugath,

From a Webmaster's viewpoint, .htaccess is often the only file we have access to. It lives at the root of a Web site - in the same directory as the default home page of a site - and/or below that in the subdirectories for the site. Therefore, the Webmaster can upload, modify, copy, or move it at will.

However, if you administrate your own server, then you'll also have access to httpd.conf, which is one of the server configuration files. It is located along with the rest of the server files at a level that users can't get to.

As incywincy noted, directives in httpd.conf are compiled at server start-up, so that processing is more efficient. Directives in .htaccess, however, must be interpreted for each and every HTTP request; Interpreting them slows things down a bit, and might be done 20 times to load a single HTML page with several images and scripts on it.

However, interpreting .htaccess directives is no less efficient than interpreting any other scripted language, so you do the same thing you'd do with any script that was to be run often: Decide exactly what you need to do and code it as efficiently as possible.

On the other hand, changing a directive in .htaccess does not require the server to be restarted, so some may wish to test their code by running it in .htaccess, and then 'port' it to httpd.conf once it is initially debugged. That option -- when available -- gives the best of both worlds.

Jim