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

Reysa's avatar
Level 1

Have 2 different sub-domain for 1 laravel project

Hello I have a laravel project that have 2 parts , for example one part is gaming and one part is movie

Now I want to have this urls for each part

game.url.com

movie.url.com

Problem is both movie and game codes are on one project and use same public folder , how can I do this?

My laravel urls is like this:

url.com/game/category

url.com/movie/category

I just don't know how to do this with sub-domains

0 likes
6 replies
Reysa's avatar
Level 1

@MohamedTammam wow it was fast! thanks it's working

But I have new problem now

I have an index page on url.com , my laravel project was game.url.com and I recently added movie part and now it's like this game.url.com/movie

now If I do it with Route::domain it would be like game.movie.url.com

How can I handle this? also I can't change the index url it should be url.com

MohamedTammam's avatar

@alirezatig3r Change your server settings to make Laravel start with url.com then you can add your old index file to Laravel view.

Route::get('/', function () {
    return view('your_old_index');
});

Route::domain('{game}.example.com')->group(function () {
    // Your games URLs
});
Route::domain('{movie}.example.com')->group(function () {
    // Your movies URLs
});

Please or to participate in this conversation.