I have started a laravel project called webdev
. I want this project to have subdomains, however, i do not know how to do so. I tried looking around and couldn't find an explanation on how to structure my project so I can use a subdomain.
Right now this is what I've done:
In /Applications/XAMPP/htdocs/project/
I created the main for webdev
with laravel new webdev
. This is where I want to have the main site. But now I want to have a subdomain for webdev
which handles all the account processing. So how do I create the subdomain for this? Do I do laravel new accounts
in /Applications/XAMPP/htdocs/project/
then how do I tell webdev
that accounts
is a subdomain?
Turn on subdomain wildcards and point them to your main app document root. Laravel routes handle wildcard sub-domains, and pass you wildcard parameters from the domain.
Route::group(array('domain' => '{account}.yourdomain.com'), function()
{
Route::get('user/{id}', function($account, $id)
{
//
});
});
Also see laravel docs for this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.