【问题标题】:laravel 5.5 - breaking subdomain patternlaravel 5.5 - 打破子域模式
【发布时间】:2018-07-24 10:54:43
【问题描述】:

我为用户实现了一个子域系统,每个用户都可以访问他们的个人资料页面,例如user.example.com

Route::domain('{subdomain}.example.com')->group(function () { 
    Route::get('/', 'ProfilesController@subDomain'); 
    });

其中ProfilesController@subDomain 是一个检索数据并重定向页面的函数。但是,无论用户走到哪里,都会始终停留在该 url 模式中。

例如,如果abc.example.com,我希望它重定向到example.com/profiles/abc。但现在我得到abc.example.com/profiles/abc。我去的任何链接都将卡在abc.example.com

如何在加载个人资料页面后打破这种模式?

【问题讨论】:

    标签: php laravel-5 wildcard-subdomain


    【解决方案1】:

    通常你会做这样的事情

    Route::group(['domain' => '{domain}'], function() { });
    

    这将允许您路由到选择的域。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-30
      • 1970-01-01
      • 2018-07-11
      • 1970-01-01
      • 2018-04-18
      相关资源
      最近更新 更多