Search code examples
laravelsubdomain

Laravel - Login redirect problem for subdomain


i have a site

http://mysite.test/login 

now if i will attempt

http://mysite.test/admin

it will redirect me to

http://mysite.test/login 

this is very fine. but now i have subdomain for same site.

http://company.mysite.test/

and this URL serves as login page as well. but when i hit

http://company.mysite.test/admin

it is redirecting me to

http://company.mysite.test/login

which is is entirely wrong. it must be redirected to

http://company.mysite.test/

for subdomain. what should i do?


Solution

  • Change you login route to Route::get('/');

    you'll also need to make changes to your Authenticate middleware that manages redirects to login page.