Ad

Laravel Subdomain

- 1 answer

I'm developing a project using the Laravel framework, the project is hosted on the shared host, now I would need to have a subdomain to be able to manage the "admin" section, I created my subdomain, you can use the Laravel project which is it on my main domain also on the new subdomain so that I can use the same database and the same files?

Ad

Answer

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. or config the webserver (e.g. nginx, apache, etc.) to do this.

Ad
source: stackoverflow.com
Ad