Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

denislam's avatar

Maintaining Session After Redirecting to Subdomains

Laravel has a route we can use for subdomains but if we use that method to redirect a user to the subdomain, the session no longer exists.

If we dd Auth::user() we get a blank output and a new cookie is created for that subdomain.

I tried clearing cookies in the browser and in framework/storage/session and config/session.php. I also set the domain='.example.com' but that does't seem to work. The session still breaks after redirection.

I need a method so that I can maintain a continuous session with subdomains even after the redirect. What's the best way to achieve this?

0 likes
0 replies

Please or to participate in this conversation.