daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Oct 21st, 2018 51 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. /*
  2. |--------------------------------------------------------------------------
  3. | Multi Sites Laravel Routing
  4. |--------------------------------------------------------------------------
  5. |
  6. | You may setup single laravel application to serve multiple applications
  7. | hosting on different domains and/or subdomain using the following
  8. | routing feature provided by laravel easily. Just define routes
  9. | as given below.
  10. |
  11. */
  12.  
  13.  
  14. // Match the domain
  15. Route::group(['domain'=> 'laravel.local'], function () {
  16.     Route::any('/', function(){
  17.         return 'laravel.local';
  18.     });
  19. });
  20.  
  21. // Match the sub domain of the domain
  22. Route::group(['domain'=> '{site1}.laravel.local'], function () {
  23.     Route::any('/', function($subdomain){
  24.         return 'Sub-Domain: site1.laravel.local:' . $subdomain;
  25.     });
  26. });
  27.  
  28. // Match any other domain
  29. Route::group(['domain'=> '{laravel}.{info1}'], function () {
  30.     Route::any('/', function($domain, $tld){
  31.         return 'Domain:' . $domain . '.' . $tld;
  32.     });
  33. });
  34.  
  35. // Match sub-domain of any other domain
  36. Route::group(['domain'=> '{site2}.{laravel}.{info}'], function () {
  37.     Route::any('/', function($subdomain, $domain, $tld){
  38.         return 'Sub-Domain:' . $subdomain . '.' . $domain . '.' . $tld;
  39.     });
  40. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top