Laravel .htaccess localhost MAMP and Mac OS X

June 9, 2013    l l4 laravel php

I was, like anyone, excited about the release of Laravel 4 and quickly set about following the initial installation instructions on a vanilla vhost locally to have a play around with. I quickly found that the default suggested .htaccess file was causing a server error in MAMP on OS X.

I got around it with a little trial and error and can confirm the below contents in your .htaccess file - works great for me.

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]

The offending line from the suggested .htaccess contents was

RewriteRule ^ index.php [L]

blog comments powered by Disqus