I am trying to create a sub-domain in laravel. The subdomain will be something like merchant.example.com
and they will be more links such as merchant.example.com/login
merchant.example.com/myaccount
so this is what I tired
Route::get('.partner/', array(
'as' => 'partner-home',
'uses' => 'HomeController@partnerHome'
));
but just redirect me to the main domain. Any idea how to this please.
Show activity on this post. $appRoutes = function() { Route::get('/',function(){ return view('welcome'); }); }; Route::group(['subdomain' => '{subdomain}. yoursitename.com'], $appRoutes ); Place this code in your route file.
by laravelrecipies. Subdomain routing is the same as routing prefixing, but it's scoped by subdomain instead of route prefix. There are two primary uses for this. First, you may want to present different sections of the application (or entirely different applications) to different subdomains.
You can register a route group to have a certain domain:
Route::group(array('domain' => 'partner.myapp.com'), function(){
Route::get('/', array(
'as' => 'partner-home',
'uses' => 'HomeController@partnerHome'
));
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With