Welcome to WebmasterWorld Guest from 18.204.227.250

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

difference between .htaccess and http.conf ...

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

New User

10+ Year Member

joined:June 5, 2003
posts:39
votes: 0


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

thanks

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

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3

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

New User

10+ Year Member

joined:June 5, 2003
posts:39
votes: 0


would u plz explain that to me in plain english ...
9:35 pm on Oct 29, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Feb 5, 2002
posts:333
votes: 0


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.
10:16 pm on Oct 29, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


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