Skip to content

Instantly share code, notes, and snippets.

@skadimoolam
Created Jun 5, 2020
Embed
What would you like to do?
How to setup Specific Subdomain routing in Laravel | https://simplestweb.in/blog/how-to-setup-specific-subdomain-routing-in-laravel
# Add the domain name of your choice
SITE_URL=myapp.com
127.0.0.1 laravel.test
127.0.0.1 admin.laravel.test
127.0.0.1 api.laravel.test
Route::middleware('web')->domain(env('SITE_URL'))->group(function() {
# .... all your marketing website routes go here
});
Route::middleware('web')->domain('admin.' . env('SITE_URL'))->group(function() {
# .... all admin portal routes go here
});
Route::middleware('api')->domain('api.' . env('SITE_URL'))->group(function() {
# .... all api routes go here
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment