Wildcard vhost does not work as expected.
Posted: 27. December 2019 17:32
I also asked this question here https://stackoverflow.com/questions/59494023/redirecting-sub-sub-domains-in-a-wildcard-vhost-apache-xampp-setup
I guess here is more appropriate
I am using XAMPP and Acrylic DNS Proxy on Windows 10, and I need to create several apps per day or week, these apps needs sometimes to be served from different domains, I'd like to use subdomains in this cases.
I am trying to serve several apps from an apache folder in domains(app1.jml => c:/apps/app1), so far I got this working.
But I'd like to redirect subdomains to the same domain(sub1.app1.jml => c:/apps/app1) and then let my app(php/mysql) handle the request.
Basically:
I got (1) working with the following vhost configuration:
But I was not able to get (2). I tried the following code:
It did not work, it gave me this:
For ServerAlias *.*.jml I tried all (%2, %0, %-1, %-2) in VirtualDocumentRoot to no avail.
Am I missing something? Thank you for your help
I guess here is more appropriate
I am using XAMPP and Acrylic DNS Proxy on Windows 10, and I need to create several apps per day or week, these apps needs sometimes to be served from different domains, I'd like to use subdomains in this cases.
I am trying to serve several apps from an apache folder in domains(app1.jml => c:/apps/app1), so far I got this working.
But I'd like to redirect subdomains to the same domain(sub1.app1.jml => c:/apps/app1) and then let my app(php/mysql) handle the request.
Basically:
- Code: Select all
app1.jml -> c:/apps/app1 (1)
sub1.app1.jml -> c:/apps/app1 (2)
sub2.app1.jml -> c:/apps/app1 (2)
app2.jml -> c:/apps/app2 (1)
sub1.app2.jml -> c:/apps/app2 (2)
sub2.app2.jml -> c:/apps/app2 (2)
I got (1) working with the following vhost configuration:
- Code: Select all
<VirtualHost *:80>
ServerAlias *.jml
VirtualDocumentRoot c:/apps/%1/
<Directory "c:/sites/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
But I was not able to get (2). I tried the following code:
- Code: Select all
<VirtualHost *:80>
ServerAlias *.jml
VirtualDocumentRoot c:/sites/%1/
<Directory "c:/sites/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAlias *.*.jml
VirtualDocumentRoot c:/sites/%1/
<Directory "c:/sites/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
It did not work, it gave me this:
- Code: Select all
app1.jml -> c:/apps/app1
sub1.app1.jml -> c:/apps/sub1
app1.app1.jml -> c:/apps/app1
For ServerAlias *.*.jml I tried all (%2, %0, %-1, %-2) in VirtualDocumentRoot to no avail.
Am I missing something? Thank you for your help