amidknight
7 months ago

Multiple Domains w/ Single Laravel Install

Posted 7 months ago by amidknight

Sort of consolidating a few questions that are old, unresolved, and kind of in keeping with my own problem.

Routes file:

echo url()->current() ."<br>";

echo request()->getHost();

Route::domain('pro.local')->group(function () {
  Route::get('/', function () {
    dd('HELLO');
  });
});

Route::group(['domain' => 'pro.local'], function() {
    dd('PRO');
});

Route::group(['domain' => 'media.local'], function() {
    dd('MEDIA');
});

Route::group(['domain' => 'software.local'], function() {
    dd('SOFTWARE');
});

Route::get('/', function () {
    return view('welcome');
});

Desire & environment: Three domains pro.local, media.local, and software.local all pointing to the same public folder using MAMP PRO 5.2 and Laravel 5.7. This is all I have done to the project so far.

Hypothesis: Using Route::domain or Route::group should result in returning the dd() text or the welcome template.

So far: I know the mono-repo setup I'm using works because I've had the three sites running off the mono-repo for about 3 years and can share the services and what not across projects. With that said, it's annoying to have to SSH into three separate folders to run composer update and npm update; especially when the composer.json and package.json files for each project is essentially the same...I currently use gulp to move and copy files around to keep things in sync.

Problem: No matter the domain, only PRO gets echoed.

I have screenshots on stack as well - because images

Similar questions

Might have missed a few. I only looked at the first page of results from a search and think I didn't actually paste at least one - all stale - all unresolved.

Please sign in or create an account to participate in this conversation.