2

I want that my laravel 5.1 accept wildcard domains.

I'm not the first one to ask this, but all other configurations I tried never worked, so maybe I' doing something wrong.

In my Bind zone file, I have:

*.domain.tld

In my Apache, I have:

NameVirtualHost xxx.xxx.xxx.xxx:80

<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName blog.domain.tld
ServerAlias www.blog.domain.tld
DocumentRoot /var/www/blog/
       <Directory /var/www/blog>
               Options Indexes FollowSymLinks MultiViews
               AllowOverride All
               Order allow,deny
               allow from all
       </Directory>
</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName domain.tld
DocumentRoot /var/www/app/
ServerAlias domain.tld www.domain.tld *.domain.tld
        <Directory /var/www/app>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

And in Laravel router I have (taken from docs):

Route::group(['domain' => '{account}.local.dev'], function () {
    Route::get('user/{id}', function ($account, $id) {
        die('routed');
    });
});

Normal access using domain.tld is fine, www.domain.tld is fine as well but any other subdomain result in a page loading without showing any result

I tried on Vagrant and on my Debian box, both using apache2.2, php5.6.

Is there something wrong ? Any suggestions are welcome

Alucard
  • 1,814
  • 1
  • 21
  • 33

0 Answers0