Document root Apache 2 can not find laravel routes

0

Based on the assumption that we are on a linux server we have the following senary.

the document root pointed to

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/laravel/public
ServerName site.com.br

hence we have a problematic because the framework can not find the routes defined in the routes.php file I think this is due to document root being pointing to the public folder hence from there it does not find the routes www.site.com/rota someone I would have a solution for that, if that's even a problem.

    
asked by anonymous 08.05.2016 / 16:02

1 answer

1

I believe the problem is occurring because you did not enable the override option in your configuration.

Try to leave Virtual Host like this:

<VirtualHost *:80>
  ServerName site.com.br
  DocumentRoot "/var/www/html/laravel/public"
  <Directory "/var/www/html/laravel/public">
    AllowOverride all
    DirectoryIndex index.php
  </Directory>
</VirtualHost>

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
    
08.05.2016 / 16:36