What is .htaccess and how to disable .htaccess?

What is .htaccess and how to disable .htaccess?

.htaccess is use to modify the way Apache behaves for a directory and it’s sub-directories. It gives you an extra control on your server, like setting up custom error messages, password protect a directory, writing rewrite rules, blocking IPs etc.

However, it can be a potentially dangerous file. For example, a hacker can redirect your website to an external website say a malware website.

In order to disable .htaccess server wide, edit the Apache configuration file

pico /etc/httpd/conf/httpd.conf

Search for

AllowOverride All

replace it with

AllowOverride None

Save the file and restart the Apache service.

service httpd restart

This entry was posted on Monday, December 14th, 2009 and is filed under Linux Administration. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.