Laravel default .htaccess file will not work

Changed this line:

    RewriteRule ^ index.php [L]

to this:

    RewriteRule ^ /index.php [L]

Now it works. Not only do I not get the 500 error, but the URLs appear to work as intended.


It seems to me the 500 internal error is coming because you have not set the virtual host in the apache httpd.conf file.

Put this line in the httpd.conf file

For windows

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName yourlaravel.com
    DocumentRoot "C:/wamp/www/laravel/public"
    <Directory "C:/wamp/www/laravel/public">
    </Directory>
</VirtualHost>

<VirtualHost *:80>
     ServerName localhost
     DocumentRoot "C:/wamp/www"
     <Directory "C:/wamp/www">
     </Directory>
</VirtualHost>

For Linux

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName yourlaravel.com
    DocumentRoot "/var/www/laravel/public"
    <Directory "/var/www/laravel/public">
 </Directory>

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "/var/www"
   <Directory "/var/www">
   </Directory>
</VirtualHost>

And to run it in your local machine

For window open the C:\Windows\System32\drivers\etc\hosts put this line.

 yourserverip   yourlaravel.com

For linux open the \etc\hosts put this line.

 yourserverip   yourlaravel.com

Your can refer to this link for further info:

http://net.tutsplus.com/tutorials/php/building-web-applications-from-scratch-with-laravel/

I hope this can be some help.