Why to use .htaccess file in apache?

Posted July 18, 2016 2.4k views


Sorry if this a dumb question, Why to use .htaccess file in apache? if I have direct access to the apache configuration files themselves and also you told any directive placed in the .htaccess file, has the same effect as it would in the apache configuration itself.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

There’s no need when you run the server yourself. It’s mainly used on shared hosting.

It can be used to manage multiple servers. If one website if hosted on multiple server (for redundency), you can simply upload your file just like any other web file, and all the htaccess config will be there.
Also, there is no need to reboot the server when you change the htaccess file