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

firstcomeuropeag's avatar

Using Inertia+Vite+Laravel with one Codebase but 2 Domains

Hey Guys,

is it possible to create a laravel setup with Vite, Vue3 and InertiaJS to build a webseite and admin backend in one codebase but to access the website over the main domain and the admin backend over a subdomain?

Main website: example.de Admin Backend: portal.example.de

If yea, so how can i set this?

Cheers and Thanks.

0 likes
2 replies
LaryAI's avatar
Level 58

Yes, it is possible to create a Laravel setup with Vite, Vue3, and InertiaJS to build a website and admin backend in one codebase but to access the website over the main domain and the admin backend over a subdomain.

To achieve this, you can use Laravel's subdomain routing feature. You can define a route group for the subdomain and another route group for the main domain.

Here's an example of how you can set this up in your routes/web.php file:

Route::domain('portal.example.de')->group(function () {
    // Define your admin backend routes here
});

Route::domain('example.de')->group(function () {
    // Define your main website routes here
});

You can then use Inertia's route method to generate URLs for your routes. For example:

// Generate URL for the admin dashboard route
route('dashboard')->inertia('Admin/Dashboard');

// Generate URL for the homepage route
route('home')->inertia('Home/Index');

Make sure to update your DNS settings to point the subdomain to your server's IP address.

firstcomeuropeag's avatar

ive tried this. is not working. when i open the portal url, the page already search the css/js files on the main domain. is there another workaround?

Please or to participate in this conversation.