Guest User

Untitled

a guest
Oct 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  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. });
Add Comment
Please, Sign In to add comment