lundi 12 février 2018

Laravel forces redirect to public folder when user is not logged in

I added this rule into the .htaccess to redirect all the requests to the public folder:

RewriteRule ^(.*)$ /public/$1 [L,NC]

This way I can strip the public word from the URI, although both mydomain.com/home and mydomain.com/public/home would work.

I now implemented the basic user authentication but what happens is that:

  1. if user requests for mydomain.com/admin and is not logged in, Laravel redirects him or her to mydomain.com/public/login instead of mydomain.com/login
  2. when user authenticates himself or herself, Laravel redirects him or her to mydomain.com/public/admin instead of mydomain.com/admin

Based on this, I guess that Laravel, somewhere, explicitates that redirects must be made at /public/whatever. I tried to figure out where redirect() helper is explicitated but I couldn't find it. My questions are:

  • Is my supposition right?
  • If yes, where Laravel defines that the redirects must be made at /public/whatever? Where I can find redirect() helper?
  • If no, why point 1 and 2 occur?


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire