Do the following in order to enable .htaccess support:

1. Check if the module rewrite_module is loaded:

# httpd -M | grep rewrite_module (in FreeBSD)
# apachectl -M | grep rewrite_module (in Linux) 

2. If it’s not enabled, configure apache to load the module:

# LoadModule rewrite_module libexec/apache/mod_rewrite.so (add the line in httpd.conf in FreeBSD)
# a2enmod rewrite (in Linux)

3. Configure the website to allow .htaccess

Add ‘AllowOverride All’ in the section ‘Directory’ of the directory where you want to enable .htaccess.

For example, to enable .htaccess under /var/www/wordpress, the ‘Directory’ section should be something like this:

<Directory /var/www/wordpress>
    AddHandler cgi-script .cgi
    Options +Indexes +ExecCGI
    DirectoryIndex index.php
    Order allow,deny
    Allow from All
    AllowOverride All
</Directory>

4. Restart apache