Baako
Baako

Reputation: 273

How to create a sub- domain in laravel

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.

Upvotes: 5

Views: 4137

Answers (1)

lukasgeiter
lukasgeiter

Reputation: 153150

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'
    ));
});

Upvotes: 5

Related Questions