How to enable .htaccess in Apache HTTP server

An .htaccess file is a directory-level configuration file for Apache HTTP server, which allows one to override the web server’s system-wide settings without modifying the global configuration file (e.g., httpd.conf or apache2.conf). Things like per-directory access control, password protection, URL redirection or hot link prevention can be configured in the .htaccess file. This post discusses how to enable .htaccess for Apache HTTP server.