Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DennisEilander's avatar

Laravel multidomain application

Hi all,

I've a question about a multidomain application. I know you can use route groups to split routes for sub domains. But I don't have sub domains but full domain names like domain1.com and domain2.com.

I've searched a lot about this case, but almost every post I read, is about sub-domain setup.

Question: Can I use one laravel application which has to be access by multiple domain names?

If it is possible, can I simple split the domains using route groups (and how?). And do I have to do some server configuration or what is the key to let this work :D

Thanks.

0 likes
4 replies
TiBian's avatar
TiBian
Best Answer
Level 37

try this...

config the nginx for example to point 2 domains in the same path/app

  listen 80;
  server_name app1.local app2.local;
  root "~/Code/Web/app/public";

and on your routes/web.php you can group the domain/request like this....

Route::domain('app1.local')->group(function () {
    Route::get('/', function () {
        return 'App 1'; // Home page for the APP 1
    });
});


Route::domain('app2.local')->group(function () {
    Route::get('/', function () {
        return 'App 2'; // Home page for the APP 2
    });
});
2 likes

Please or to participate in this conversation.