This guide describes how to configure a 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 a subdomain in cpanel and point its directory to the 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
I wrote the first time, and I am looking forward to hearing your opinion on how can I improve.
thanks
Discussion (0)