this guide describes how to configure subdomain for laravel project.
Using example.com
if you own example.com
and want to create subdoamin.example.com
and handle it with laravel.
then follow these steps.
- Create sub domain in cpanel and point its directory to laravel project directory.
- now in your
routes/web.php
add this snippet.
/*subdoamin*/
Route::domain('subdoamin.example.com')->group(function () {
//mobile routes
Route::get('/', function(){
dd("Reserved For subdoamin.example.com Site") ;
});
}
);
Now visit
subdoamin.example.com
and you will get
Reserved For subdoamin.example.com Site