phpapache.htaccesshttp-redirectlaravel

Laravel redirects to a route but then apache gives 404 error


I have a site that is working on the same server in a different url (staging), but now I've deployed the site and the base url ("/") is redirected to the login url (so laravel is sort of working), but then I get a 404 error from apache.

If I use sub.domain.com/index.php/route, it works, but if I use sub.domain.com/route redirects to the login route and gives a 404 error.

I also changed the routes.php to return the login view in the route "/" and it show the login form correctly.


Solution

  • After adding

    AllowOverride All
    

    to the vhost configuration, got it working. Probably the default configuration wasn't allowing the redirects?

    Here's my final (and working) vhost configuration:

    DocumentRoot /var/www/sitefolder/public
     ServerName site.domain.com
     <Directory /var/www/sitefolder/public>
      AllowOverride All
      allow from all
      Options +Indexes
    </Directory>