How to run a Laravel application when hosted through a virtual host?

Coming from CodeIgniter, I would like to know Laravel. But I rack my brains for 2 days on a (small) problem.

When I look at the URL "laravel.app", it shows me the contents of the folder instead of the Laravel index page.

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", otherwise I get 404. What could be the problem?

Hello

+4
source share
2 answers

I would check public / index.php and try to add this line to your .htaccess file.

 DirectoryIndex index.php 

You can also mark this with "mamp". Hope you find it!

+4
source

Did you check the /config/application.php application for the next login?

'index' => 'index.php',

if you don't have mod_rewrite to set clean_urls

0
source

Source: https://habr.com/ru/post/1435733/


All Articles