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
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
});
});
if you want a solution for using a single Laravel app to serve multiple HTTP domains, I've developed this package which allows to use, in a single application, a specific env file and a specific storage folder for each served domain. Also artisan commands and queues are managed in multidomain setting.