Skip to content

Instantly share code, notes, and snippets.

@skadimoolam
Created June 5, 2020 05:17
Show Gist options
  • Save skadimoolam/a97ed547c772541ce1030499f7d0d611 to your computer and use it in GitHub Desktop.
Save skadimoolam/a97ed547c772541ce1030499f7d0d611 to your computer and use it in GitHub Desktop.
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