I am having a hard time running my application (built on laravel 5.4) on a wildcard subdomain that I have setup on my local machine (running Apache 2.4.18 on Linux Mint 18.1) So, I have setup a vhost (domain.app) and a subdomain (sub.domain.app) for it and my apache vhost file looks like the following: # This is for the primary domain (domain.app) <VirtualHost *:80> ServerName domain.app ServerAlias www.domain.app ServerAdmin webmaster@localhost DocumentRoot /var/www/html/test/domain.app/public <Directory /var/www/html/test/domain.app/public> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <IfModule mod_dir.c> DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm </IfModule> </VirtualHost> # This is for the subdomain (sub.domain.app) <VirtualHost *:80> ServerName domain.app VirtualDocumentRoot /var/www/html/test/%0/public ServerAlias *.domain.app <Directory /var/www/html/test/sub.domain.app/public> <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> </VirtualHost> Code (markup): This works fine for all of the following urls: - http://domain.app - http://domain.app/login - http://domain.app - http://sub.domain.app/login But since, I want a wildcard subdomain, meaning I do not want to hardcode sub.domain.app in the vhost but want something like anything.domain.app so I tried to replace <Directory /var/www/html/test/sub.domain.app/public> with <Directory /var/www/html/test/%0/public> I get the following results: - http://domain.app (works) - http://domain.app/login (works) - http://domain.app (works) - http://sub.domain.app/login (404 Not found, The requested URL /login was not found on this server.) Please can someone help me? Thanks in advance