if you have setup a new server and suddenly you find out that .htaccess configuration file is not working on your here is a quick solution to fix it.
There might be 2 issues with your web server which could have caused this problem.
1. Make sure AccessFileName set to .htaccessTo check this open httpd.conf or apache2.conf depending on your OS and search for AccessFileName and make sure it is set to .htaccess nano /etc/httpd/conf/httpd.conf
if you dont have nano you can install nano yum install nano
2.Make sure users are allowed to use .htaccess file To check this open httpd.conf or apache2.conf depending on you OS search for AllowOverride and make sure it is set to AllowOverride All
also make sure you restart your apache after applying changes