1

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:

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:

<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:


<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:

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 :-)

JBoulhous
  • 844
  • 7
  • 11

1 Answers1

1

I have also posted this answer in the Apache Friends Support Forum and got a reply that my two rules collide, so I fixed the first par of my configuration and removed the second part:

<VirtualHost *:80>
    ServerAlias *.jml
    VirtualDocumentRoot c:/sites/%-2/

   <Directory "c:/sites/">
      Options +Indexes +Includes +FollowSymLinks +MultiViews
      AllowOverride All
      Require all granted
   </Directory>
</VirtualHost>
JBoulhous
  • 844
  • 7
  • 11