Xampp Virtualhost: Wildcard domains and sub-domains
I figured it out, to add sub-domain functionality both through wildcards i just had to use a second asterisk before in the *.domain.local to * . *.localSo the final result will be as follows:
<VirtualHost *:80> DocumentRoot "C:/xampp/www" ServerName localhost ServerAlias localhost</VirtualHost><Virtualhost *:80> VirtualDocumentRoot "C:/xampp/www/%-2/sub/%-3" ServerName sub.domain.local ServerAlias *.*.local <Directory "C:/xampp/www/*/sub/*"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory></Virtualhost><Virtualhost *:80> VirtualDocumentRoot "C:/xampp/www/%-2" ServerName domain.local ServerAlias *.local <Directory "C:/xampp/www/*"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory></Virtualhost>
And the important part is this:
VirtualDocumentRoot "C:/xampp/www/%-2/sub/%-3"ServerName sub.domain.localServerAlias *.*.local<Directory "C:/xampp/www/*/sub/*">
Simple fix making it easy to create Sub domains within the same folder as the main domain. Allowing you to easily create multiple domains within one single project folder.
XAMPP 7.3.7 (INFINITE *.LOCALHOST) + SOME SYMFONY v4 DOMAINS
Edit and activate the Apache "vhost alias module" (Uncomment the #)
FILE=C:\xampp\apache\conf\httpd.conf
LoadModule vhost_alias_module modules/mod_vhost_alias.so
FILE=C:\xampp\apache\conf\extra\httpd-vhosts.conf
Edit with this, works OK with Chrome (Not Firefox)
############################### LOCALHOST#############################<VirtualHost *:80> UseCanonicalName Off DocumentRoot "C:/xampp/htdocs/" ServerName localhost</VirtualHost>############################### SYMFONY VHOSTS (/public)#############################<VirtualHost *:80> UseCanonicalName Off DocumentRoot "C:/xampp/htdocs/symfonyapi/public/" ServerName symfonyapi.localhost <Directory C:/xampp/htdocs/symfonyapi/public/> AllowOverride All Order Allow,Deny Allow from All </Directory> </VirtualHost><VirtualHost *:80> UseCanonicalName Off DocumentRoot "C:/xampp/htdocs/symfonyweb/public/" ServerName symfonyweb.localhost <Directory C:/xampp/htdocs/symfonyweb/public/> AllowOverride All Order Allow,Deny Allow from All </Directory></VirtualHost>############################### VHOSTS *.LOCALHOST#############################<VirtualHost *:80> UseCanonicalName Off ServerAlias *.localhost VirtualDocumentRoot "C:/xampp/htdocs/%1/"</VirtualHost>
For HTTPS
FILE=C:\xampp\apache\conf\extra\httpd-ssl.conf
<VirtualHost _default_:443># General setup for the virtual host# DocumentRoot "/xampp/htdocs"# ServerName www.example.com:443# ServerAdmin admin@example.com# ErrorLog "/xampp/apache/logs/error.log"# TransferLog "/xampp/apache/logs/access.log"UseCanonicalName OffServerAlias *.localhostServerAdmin admin@example.comVirtualDocumentRoot "c:/xampp/htdocs/%1"ErrorLog "/xampp/apache/logs/%1.error.log"TransferLog "/xampp/apache/logs/%1.access.log"
Create domains:
C:\xampp\htdocs\dev1C:\xampp\htdocs\dev2C:\xampp\htdocs\dev3