All the development works mostly we are doing in localhost and using htaccess to get a SEO friendly URL is becoming a part of almost all PHP websites nowadays.
Most of the time we are doing all the work without htaccess operations in localhost and after moving it to the server we are writing the htaccess operation again. This is really a headache and the reason why we are doing is because in localhost host .htaccess won’t work.
But there is always a solution for a problem, just follow the below steps so you can make .htaccess file work in Localhost too!
Steps to follow (XAMPP):
1. Go to XAMPP directory -> apache -> conf => (eg: C:\xampp\apache\conf)
2. Search for this file “httpd.conf “
3. Open this file and find this line “#LoadModule rewrite_module modules/mod_rewrite.so”
4. Remove the # in front of this line and save this file “LoadModule rewrite_module modules/mod_rewrite.so”.
5. Restart the XAMPP (Important!)
Steps to follow (WAMPP):
1. Right click on the WAMPP icon on task bar. You will see the below screen:
2. Open this file and find this line “#LoadModule rewrite_module modules/mod_rewrite.so”
3. Remove the # in front of this line and save this file “LoadModule rewrite_module modules/mod_rewrite.so”.
4. Restart the WAMPP (Important!)
Enjoy the day!