Enable .htaccess on Apache HTTPD Server

Occasionally, there becomes a need to expose the use of the .htaccess file to the domains hosted on your Apache server. This technique is particularly useful when you host websites for external clients (or developers).

The steps to enable it are relatively easy,

  • Uncomment the ‘httpd.conf’ line that reads as:

    LoadModule rewrite_module modules/mod_rewrite.so

  • Review (and replace as appropriate) all cases of :

    AllowOverride None with AllowOverride All

    in the following files:
    httpd.conf, /extra/httpd-vhosts.conf, /extra/httpd-autoindex.conf and any related files you may be using.

  • Add the .htaccess file into the appropriate websites/folders
  • Restart the server to accept the changes

NOTE: If you develop or host on Windows, you’ll likely have problems creating the file because there is no filename, just a file extension. You can create (or download) it from any non-Windows host and use it without additional changes. Apache does let you use a different filename, but you also need to be careful to update related security configuration that is used to prevent download of such files.

Happy hosting!