Wildcard subdomains redirect?

RealNames

Verified User
Joined
Feb 22, 2004
Messages
50
I have a small website where there was a bunch of subdomains and traffic going to the subdomains from the old website prior to my purchase of the domain.

Do not know the names of the subdomains so need to use a wildcard so that traffic is not lost and goes to my index.html page.

Can someone please tell me in simple terms (even a non-experienced DA reseller & a non-geek can understand) how to set that up? Thanks.
.
 
Hello,

Go to your Dns Control and add the following "A" record.

* A 1.2.3.4

where 1.2.3.4 is your IP address. That will ensure that anything.yourdomain.com will resolve.

Next, you need to setup a ServerAlias to handle the *. You'll need admin access on the server to do this, but you go to:

Admin Panel -> Admin Settings -> Custom Httpd.conf -> yourdomain.com.

In the textarea, just paste:

ServerAlias *.|DOMAIN|

and click save. This will make all subdomains point to your webpage. (Note that *all* subdomains will point to your webpage as the * takes priority over real subdomains because the VirtualHost appears first in the httpd.conf file.)

John
 
New feature maybe???

Hi John,

Is it possible to add this functionality (but then for all undefined sub-domains)? I know that some of my users would be very happy with this feature.

Kind REgards,
Onno Vrijburg
 
DirectAdmin Support said:
Hello, Go to your Dns Control and add the following "A" record.
* A 1.2.3.4 where 1.2.3.4 is your IP address. That will ensure that anything.yourdomain.com will resolve.....

Thanks but I am confused on if this will work correctly since there are about 15 sites using each IP Address, will that effect all the sites? How would the system know which site to send the wildcard subdomain too? i.e. only 5 of the 15 need the wildcard subdomain but all 5 and the other 10 are on the same IP.
 
If you use a wildcard DNS record, then any subdomain request not already defined in the DNS zone file will be responded to with that IP#.

So to use a different IP# for a specific subdomain, just create an A record for that subdomain in the same zone file.

Jeff
 
You need to add it to the custom httpd.conf file for that user as well otherwise it wont work.

Regards,
Onno
 
The reason I didn't mention Onno's fix is because I presumed the original poster was creating subdomains using DA, which should add the code to the httpd.conf file.

Did I miss something?

Jeff
 
Back
Top