Trying to make a default router on the domain and sub domain, that's what I try:

Route::get('/', function () { return 'home'; }); Route::group(['domain' => 'video.s1.loc'], function () { Route::get('/', function () { return 'sub'; }); }); 

As a result, when switching to s1.loc and video.s1.loc, "home" appears, how to make it appear that "sub" would appear when switching to video.s1.loc. If you add / test to the sub route, then by switching to video.s1.loc / test it displays "sub", but does not want to work in the root directory, how to fix it?

    1 answer 1

    The main domain routs need to be grouped into a group similar to a sub domain.

     Route::group(['domain' => 's1.loc'], function () { Route::get('/', function () { return 'home'; }); }); Route::group(['domain' => 'video.s1.loc'], function () { Route::get('/', function () { return 'sub'; }); });