mardi 19 juin 2018

Dynamic subdomain Laravel

I want to know, how to create dynamic subdomain with laravel 5.6 and wampserver My code in web route for test

Route::group(array('domain' => '{subdomain}.test.local'), function () {
    Route::get('/', function ($subdomain) {
        $name = DB::table('users')->where('username', $subdomain)->get();
        dd($name);
    });
});

I do one parameter on my vhost and httpd-vhosts. After I added alias name. Result here

<VirtualHost *:80>
    ServerName test.local
    ServerAlias *.test.local
    DocumentRoot "c:/wamp64/www/test"
    <Directory  "c:/wamp64/www/test/">
        Options Indexes FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from all
    </Directory>
</VirtualHost>

In my browser I try to use test.test.local for try if subdomain is correct but doesn't work. Note: I would like to have variable subdomain Thank you for your answer



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire