Support the ongoing development of Laravel.io →
Configuration Views

I am working on multi-tenant approach. I created a new tenant with all its information in database including its sub-domain. My approach is separate database and separate sub-domains for each customer. So, I am creating a sub-domain on button click and saving it in database. Now, I am lost on my way how to redirect that sub-domain to main page. I just need to redirect it to main page nothing else, I will work on separate db connection later. I also created the wildcard subdomain entry from cpanel. I am working on wildcard domains for the first time and also I am on my way of learning laravel.

Here is my code:

routes/web.php

Route::group(array('domain' => '{account}.example.com/tracker'), function()
{
      Route::get('/', 'HomeController@index');

});

HomeController.php

<?php

    namespace App\Http\Controllers;

    use Illuminate\Http\Request;

    class HomeController extends Controller
    {

          public function index()
          {
                return view('welcome');
           }
    }

I know there are lot of things missing that's why its not working but I tried many solutions I found on google but still I am unable to figure out what I am doing wrong. Please help me how to overcome this issue.

Thank you

Last updated 3 years ago.
0

anybody there? Please help.

0

instead of returning a view from the controller return a redirect

return redirect('/path/to/');
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.