Two most common causes of this behavior are:
-
mod_rewrite not enabled
sudo a2enmod rewrite && sudo service apache2 restart -
AllowOverrideis set to None, set it to All, assuming Apache2.4sudo nano /etc/apache2/apache2.conf
search for <Directory /var/www/> and change AllowOverride None to AllowOverride All, then save the file and restart apache