Kevin Gorjan Kevin Gorjan - 24 days ago 7
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 "laravel.app", 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"
ServerName laravel.app

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


.htaccess:

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

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


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

Regards

Answer

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!