Wildcard subdomains to specific directory

3 posts / 0 new
Last post
#1 Sun, 07/21/2019 - 04:40
ChristianFrC

Wildcard subdomains to specific directory

Hello, I've just spent hours trying to manage my wildcard subdomains. I have a main virtual server and multiple subservers:

MainVirtualServer.com -> SubServer1.com -> SubServer2.com -> SubServer3.com

I would like to redirect all wildcards subdomains of the main virtual server and of all subservers (except www. and . of course) to the same specific directory located inside /home/MainVirtualServer.com (ie: /home/MainVirtualServer.com/wildcards).

I've seen the "Website matches all sub-domains?" functionnality but I don't want anything.SubServer1.com redirects to www.SubServer1.com Thanks for your help.

PS: I don't need SSL for the wildcard subdomains

Sun, 07/21/2019 - 16:42
noisemarine

It's been a long time since I've played around with wildcard subdomains, but I seem to remember they need to be the last entry in the conf file. That is, give them their own VirtualHost stanzas, but put those at the bottom of the file. I suspect they will need to go in the "default" site config.

Wed, 07/31/2019 - 08:28
ChristianFrC

For those who may be interested I found i way to solve my problem. I've disabled "Website matches all sub-domains?" on my main server mydomain.tld. I've created a subserver of my main server (ie: allmywilcards.mydomain.tld). And I've enabled "Website matches all sub-domains?" on this subserver allmywilcards.mydomain.tld All my wildcard subdomains of mydomain.tld are now pointing to the home directory of allmywilcards.mydomain.tld