Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- |--------------------------------------------------------------------------
- | Multi Sites Laravel Routing
- |--------------------------------------------------------------------------
- |
- | You may setup single laravel application to serve multiple applications
- | hosting on different domains and/or subdomain using the following
- | routing feature provided by laravel easily. Just define routes
- | as given below.
- |
- */
- // Match the domain
- Route::group(['domain'=> 'laravel.local'], function () {
- Route::any('/', function(){
- return 'laravel.local';
- });
- });
- // Match the sub domain of the domain
- Route::group(['domain'=> '{site1}.laravel.local'], function () {
- Route::any('/', function($subdomain){
- return 'Sub-Domain: site1.laravel.local:' . $subdomain;
- });
- });
- // Match any other domain
- Route::group(['domain'=> '{laravel}.{info1}'], function () {
- Route::any('/', function($domain, $tld){
- return 'Domain:' . $domain . '.' . $tld;
- });
- });
- // Match sub-domain of any other domain
- Route::group(['domain'=> '{site2}.{laravel}.{info}'], function () {
- Route::any('/', function($subdomain, $domain, $tld){
- return 'Sub-Domain:' . $subdomain . '.' . $domain . '.' . $tld;
- });
- });
Add Comment
Please, Sign In to add comment