you need to pass the fulldomain, not only the hostname
Route::group(['domain' => 'api.withdomain.name', 'prefix' => 'v1'], function () {
https://laravel.com/docs/5.7/routing#route-group-sub-domain-routing
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am trying to make the laravel api routes go to a subdomain but cant seem to find anything that solves what I am trying to do.
My front end needs to point to api.site.com/v1
My routes api.php file wraps everything like so:
Route::group(['domain' => 'api', 'prefix' => 'v1'], function () {
...all the site routes / endpoints
But I can not seem to get that going.
Any help / insight would be greatly appreciated.
Thanks,
Dave
Please or to participate in this conversation.