Kevin Gorjan Kevin Gorjan - 1 year ago 66
Apache Configuration Question

How to run Laravel app when hosted through virtual host?

Coming from CodeIgniter, I'd like to learn Laravel.
But I'm breaking my head 2 days over a (small) problem.

When I browse to the URL "", It shows me the folder content instead of the index-page of Laravel.

These are my settings:

Virtual Host:

<VirtualHost *:80>
DocumentRoot "/Applications/MAMP/htdocs/laravel/public"

<Directory "/Applications/MAMP/htdocs/laravel/public">
Options All
AllowOverride All


<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
Order allow,deny
Allow from all

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

I added "Order allow, deny" and "Allow from all", else I get a 404.
What could be the problem?


Answer Source

I would verify public/index.php exists, and then try adding this line to your .htaccess file.

DirectoryIndex index.php

You may also want to tag this with "mamp". Hope you find it!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download