PDA

View Full Version : wildcard dns record


mainswitch
01-09-2004, 04:15 PM
Hi

i want to add wildcard dns record for domains

*.domain.com

so i put * in the CNAME section

when i check in browser i go directly to the mainroot

/var/www direction

and no to the site

does anybody know how i can setup dns wildcarcs for subdomains?


thnx

Paul

ProWebUK
01-09-2004, 04:18 PM
You will more than likely come across problems having a wildcard on the main domain with subdomains.

to have wildcarded subdomains on the subdomain simply add the dns record:

*.sub.domain.com A IP

S2S-Robert
01-11-2004, 10:23 AM
A customer of mine requested this as well, on the main domain that is. So how would I go about adding it?

I have to add a "* A <ip>" DNS record, but the difficult part is the ServerAlias. If I add it using the custom httpd admin feature and simply add the line


ServerAlias www.domain.com domain.com *.domain.com

It will add the line right after the <virtualhost> line, and afterwards gets undone by the second ServerAlias.

Any thoughts?

ProWebUK
01-11-2004, 10:30 AM
You shouldn't need to modify anything yourself, simply add the wildcard record to your DNS entries - not tried it but should work.

Chris

S2S-Robert
01-11-2004, 10:34 AM
No, in order to be redirected to the sites main domain you have to have a ServerAlias part. I want all subdomains redirected to the main domain, so this would mean having the * added (redirect them to the ip) and then setting up the ServerAlias part.

The only thing that bugs me is that I can't seem to change the ServerAlias line using the custom httpd admin function.

DirectAdmin Support
01-11-2004, 11:00 AM
Hello,

Just add a 2nd ServerAlias line.. I'm pretty sure it can handle two lines. One line would be the default line from the template, and the 2nd line would be what you enter throught the custom httpd.conf textarea.

John

jlasman
01-16-2004, 08:49 PM
One more thing to remember about wildcard lines in zone files, taken from the "DNS and Bind" book:

"Wildcards do not match names for which there is already data."

That means, for example, if you've got a wildcard for an A record or a CNAME record, and you want the wildcard to cover, for example, john.example.com, but you've got an MX record for john.example.com, then the wildcard won't match john.example.com.

It doesn't matter what kind of record it is. If it exists in any record type, the wildcard won't match it, even for a different record type.

Jeff

rau
01-21-2004, 02:03 PM
Hi all members of DirectAdmin,

I'm currently using DirectAdmin as a Reseller and User at the same time. In my user zone I have a lot of domains all associated with my own ip. I'm gonna put examples so you can understand what I'm trying to do. The topic of course is wildcard dns.

I have 3 domains: 1.com, 2.com, 3.com

If I type put my http://myip the domain that will appear is 1.com because DA orders them in alphabetical order. So if I decide to add 0.com then my main domain would be 0.com

Now the problem wildcard
In the dns zone of, lets say, 2.com, I tried with * A myip, * CNAME 3.com, * CNAME *.3.com and more combinations. All of them worked BUT all of them redirected to 1.com or if u take the 0.com example, they would go to 0.com. So the only way to catch I found for every wildcard *.2.com *.3.com, is in the .htaccess of 1.com so then I redirect them to the place I want with .htaccess and mod_rewrite. I was wondering how could I fix this or do this correctly, meaning every wildcard subdomain go to the specific domain directory. ie. *.2.com goes to 2.com, *.3.com goes to 3.com and not everything going to the first alphabetical domain ie 1.com or 0.com if u take the example I wrote before.

Thanks a lot,

Raul

S2S-Robert
01-21-2004, 05:28 PM
You would have to be the server administrator and edit the httpd.conf file for that specific domain. It should have an additional serveralias line that covers *.domain.com

Ask your admin he can do it for you, it's actually quite simple and like John said it can handle two lines, so that's no problem. I've successfully set this up for 2 customers already.

rau
01-21-2004, 06:37 PM
Thanks Robert for the fast reply! :)

And John it would be great to implement this little feature in the next DA update. Anyway I must admit that DA with the way it handles multiple domains, the object oriented concept and nice layout knocks out the competition.

And again Thanks!

Raul

aleborg
08-27-2004, 05:53 AM
I have now, for one domain, added ServerAlias *.domain.com but this wildcard does eat up all other subdomains which is defined later in httpd.conf. How may I have wildcard subdomains only for those subdomains which is not listed in httpd.conf?