简体   繁体   中英

Laravel Subdomain

我正在使用 Laravel 框架开发一个项目,该项目托管在共享主机上,现在我需要一个子域才能管理“管理”部分,我创建了我的子域,您可以使用 Laravel 项目这是在我的主域上还是在新子域上,以便我可以使用相同的数据库和相同的文件?

Yes, you can use the same DB and files. You may use subdomain routing to handle your subdomain URIs:

Route::domain('admin.myapp.com')->group(function () {
    Route::get('users', function () {
        //
    });
});

Note: You should point your subdomain to your main domain, you may use CNAME *.myapp.com. myapp.com. CNAME *.myapp.com. myapp.com. or config the webserver (eg nginx, apache, etc.) to do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM