4 years ago

Dynamic sub-domain creation on new User registration in laravel 5 and WampServer

Posted 4 years ago by ahmadbadpey

I want to assign a Specific subdomain to each user after registration based on her Username on the local wampServer for a domain like tc.dev

I've done all steps that been said in This Topic or other similar topics on the web.

This is configuration that i added to httpd-vhosts.conf file:

    <VirtualHost *:80>
DocumentRoot "D:/wamp/www/tc/public/"
ServerName tc.dev
ServerAlias *.tc.dev
<directory "D:/wamp/www/tc/public/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from all

And this is what I added to C:\Windows\System32\Drivers\etc\hosts file :   tc.dev   *.tc.dev

and this is My route :

Route::group(['domain' => '{account}.tc.dev'], function () {
        Route::get('/', function ($account, $id) {
            return view('main.pages.user.index');

tc.dev works fine but any subdomain that I test does not work and index view not shown.

what is problem and solution?

Please sign in or create an account to participate in this conversation.