I've setup a new install of Laravel on my local. It appears there are issues with htaccess or Apache settings. I've researched for a number of hours and tried everything I read.
- OSX Lion 10.7.5
- MAMP 3.0.5
- PHP 5.5.10
- mod_rewrite is being loaded.
My development server works with other sites. This is the first time I am trying Laravel 4.
I get a 403 Forbidden on the welcome page which is located at website.dev:8888/
Apache gives me this error: Directory index forbidden by Options directive
Here is my .htaccess file content:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Here are a few additional actions I've taken:
- AllowOverride is set to All in httpd.conf
- Added virtual host code section to httpd-vhosts.conf
- verified that the hosts file contains a line for the site 127.0.0.1 website.dev
I've also tried various lines in the htaccess which I found in articles and I also restarted apache each time I made changes to the conf files. No routes work. When I go to website.dev:8888/public I get a blank page, no error. If I go to a route I created such as website.dev:8888/users I get a 404 not found error.
Thank you for your help!
The framework ships with a
public/.htaccess
file that is used to allow URLs withoutindex.php
. If you use Apache to serve your Laravel application, be sure to enable themod_rewrite
module.If the
.htaccess
file that ships with Laravel does not work with your Apache installation, try this one:Answer
Heres what I found that worked. Delete the
.htaccess
file inside the/public
directory and then put the following into the laravel installation's document root.Clarification
So for clarification if your laravel application is installed at
/public_html/laravel
you will look inside/public_html/laravel/public
and delete the.htaccess
file there. Then inside the/public_html/laravel
directory make a new file called.htaccess
Copy the code below to a new .htaccess file in the doc root
Please note
As Concordus Applications noted in their answer here make sure that the
Loadmodule mod_rewrite
is uncommented (make sure there is not a#
symbol behind it in your apache config file)Concordus Applications also noted that you should have
AllowOverride
set to the appropriate setting. The example they gave was the following.Please make sure to restart your apache server if you made any changes to your apache config file.