Laravel-4 Routes Not Working? Here is the solution

It's frustrating when your routes aren't working as expected and returns 404 error instead. It was really irritating and wasted couple of my precious hours. After a while i came up with the solution.

The error comes up because the .htaccess file is lack of permission.  Follow these steps to get it right. 

Step - 01
If you are using wamp/xampp open "httpd.conf" file.
Search for "LoadModule rewrite_module modules/mod_rewrite.so".
Remove the '# 'in front of it and enable it by uncommenting.    

Step - 02

Again search for "<Directory />" in httpd.conf file.
Change "AllowOverride None" to "AllowOverride All" under Directory tag.
Save Changes. 

Step - 03
Restart Apache Server. 

The default .htaccess file that Laravel provides in the public folder specified some mod_rewrite rules. These rules were not getting applied because AllowOverride was set to none. Be sure and restart apache after changing these settings.

Cheers! 


Comments

Popular posts from this blog

Dependency Injection in ASP.NET MVC 5 with StructureMap

Real-time web with Node.js & Socket.io

First Look at AngularJS 2.0