Redhat/Centos/Fedora

Edit /etc/httpd/conf/httpd.conf
Find the following information:
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None
and change to:
 AllowOverride All
Save and exit your editor.
Restart your web server:
 sudo /etc/init.d/httpd restart

Ubuntu/Debian

Edit /etc/apache2/sites-available/default :
Locate the following section:
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
and change AllowOverride None to:
       AllowOverride All
Save and exit your editor.
Restart your web server:

sudo a2enmod rewrite

sudo /etc/init.d/apache2 restart