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

bufferoverflow's avatar

Get current host in subdomain routes group

I have a group of routes for my user's subdomains like this:

Route::group(['domain' => '{subdomain}.mysite.test' ], function () {

    Route::get('/', function($subdomain) { ... });
});

I want to replace {subdomain}.mysite.test for something like '{subdomain}.' . request()->getHttpHost() so I can also use it in production.

I don't know what's wrong because this method is not working for me.

0 likes
1 reply
bufferoverflow's avatar
bufferoverflow
OP
Best Answer
Level 7

Ohh really? I actually found it searching for another thing: {subdomain}.{domain}.{tld}

Please or to participate in this conversation.