In my site (school management system) , i want to generate mini-site for each of the teacher and the admin member. Where the teachers and the admin member can put there task and other things.By using sub domain, i want to get this mini-site. So, how can i get this sub domain and how to access that sub domain?
Asked
Active
Viewed 390 times
1 Answers
1
You can follow the documentation for sub-domain routing: https://laravel.com/docs/5.2/routing#route-group-sub-domain-routing
Route::group(['domain' => '{account}.myapp.com'], function () {
Route::get('user/{id}', function ($account, $id) {
//
});
});
Don't forget to configure NGINX or Apache to properly handle sub-domains as well. Good Luck !

Christophe Hubert
- 2,833
- 1
- 12
- 25
-
@abdtpbd If you believe the answer helped you, don't forget to accept the solution :) – Christophe Hubert Jan 13 '17 at 14:41
-
Do you have some resource on how to configure NGINX or Apache to properly handle sub-domains? – Lama Nov 06 '21 at 09:18
-
@Lama I'm more used to NGINX. I use wildcard for subdomain and send everything to Laravel (you can have an ideas there : https://serversforhackers.com/c/nginx-multi-tenancy ) – Christophe Hubert Nov 07 '21 at 07:22