Search code examples
laravelroutessubdomain

Laravel subdomain route problame


I am working on a subdomain system on laravel.

suppose my main domain name is: test.test and my subdomain name is: subdomain.test.test

Now, the problem is, when I use the main domain route in sub-domain blade file like:

<a href="{{route('profile')}}">Profile</a> 

then, it should generate links like test.test/profile but, it's generating links with subdomain like: subdomain.test.test/profile

Now, How can I solve this problame?


Solution

  • An alternative would be to use relative path instead of absolute using route() helper third parameter.

    <a href="{{config('app.url')}}{{route('profile',[], false)}}">Profile</a>