【发布时间】:2019-04-23 22:17:01
【问题描述】:
Route::domain('{account}.myapp.com')->group(function () {
Route::get('/', function ($account) {
dd("Cant hit this area");
});
Route::get('/test', function ($account) {
dd("No problem reaching this area");
});
});
当我访问我的子域时,例如test.myapp.com 它不会命中那个 DD,但如果说我做一个 /test 并访问它,它会起作用。
我也尝试过 Route::get(' ' ,将其留空,但它不会捕获基本子域。
我的 Apache 会议:ServerAlias *.example.com
参考:https://laravel.com/docs/5.8/routing#route-group-sub-domain-routing
更新
我也试过了,无法执行
Route::group(['domain' => '{account}.example.co'], function () {
Route::get('/', function ($account) {
dd("HIT");
});
});
【问题讨论】: