Laravel .htaccess localhost MAMP and Mac OS X

June 09, 2013

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 %{REQUESTFILENAME} !-d RewriteRule ^(.+)/$ http://%{HTTPHOST}/$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]

About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.