Home > Back-end >  Laravel subdomain route problame
Laravel subdomain route problame

Time:01-05

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?

CodePudding user response:

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> 

CodePudding user response:

I recommend you to use Spatie Multitenancy, when i do route('home'), he return back the url with the actual domain.

  •  Tags:  
  • Related