Wildcard DNS and subdomains
Solution 1
Try creating an A or CNAME record with * as the subdomain and your server's IP (A record) or domain (CNAME record) as the destination. If your host's control panel doesn't permit a wildcard, you'll have to contact them for help, or move your DNS to a third party.
Solution 2
Some advice against wildcard web sites:
What will you do when someone starts publicizing your website as "http://this.company.sucks.domain.com" and it resolves / renders correctly?
Solution 3
A Bind DNS server allows you to create wildcard A records like this:
*.mydomain.com. IN A x.x.x.x
Or, if they are using a web control panel, create an A record for the host * , at your IP address.
Windows 2000 DNS server takes some effort to use wildcarding:
Step 1. Enable LooseWildcarding. Loose Wildcarding http://technet.microsoft.com/en-us/library/cc940790.aspx
Step 2. Use Dnscmd to create the Wildcard record. http://support.microsoft.com/default.aspx?scid=kb;en-us;840687
I'm not sure about Server 2003 and newer - there was an issue with wildcards in Server 2003 DNS not working if you have WINS forward lookup enabled
Related videos on Youtube
mrembisz
Updated on September 17, 2022Comments
-
mrembisz almost 2 years
Let'say that i've got the domain mydomain.com.
I want that when any visitor goes to
www.mydomain.com
xyz.mydomain.com
abc.mydomain.com
asd.mydomain.com
qwe.mydomain.com
etc...the visitor will continue seeing "xyz.mydomain.com", but the real address will be "mydomain.com". my asp.net application will handle the differences between the addresses. I want that the subdomain can be anything.
The problem is: I'm using a shared host. They allow me to create subdomains and allow me too create some DNS records:
Address (A)
CNAME
Mail (MX)
IPV6 (AAAA)
TXTThere is possible setup my hosting to accept that asterisk/wildcards for subdomains? How I do?
-
Dave Cheney about 15 yearsYou should consider the SEO implications of this.
-
Alnitak about 15 yearsWhat SEO implications? Do the search engines demote listings from wildcarded sites or that aren't www.{domain} ?
-
Leonard Challis about 10 yearsIt's not a problem. Just use canonical urls: support.google.com/webmasters/answer/139066?hl=en
-
-
azethoth almost 15 yearsAgreed. Just make a single A record for the hostname of the server and then you can make aliases for the websites themselves. Doing this will help you if you ever need to change IP addresses again.
-
ceejayoz over 14 yearsThe use case for this is usually for things like account_name.example.com in web applications - highly useful, and a nightmare to set up manually on a DNS server if you've lots of signups. If someone publicises this.company.sucks.example.com, you can always set up a spurious A record for that particular subdomain.
-
mpbloch about 14 yearsOr in your Web server software, where I assume you would alias xyz.example.com to the xyz site, have any unmatched queries (still pointing at the same server) use a normal redirect, so the browser changes to example.com or www.example.com. You could even throw in a 404 page at the end of the redirect.
-
mit about 9 yearsHaving a wildcard DNS does not mean that the webserver delivers a website for each possible name. The webserver has to be configured seperately. For example it would be possible to configure a webserver so it delivers only USRNAME.example.com but not anything else.
-
Mikko Rantalainen over 3 yearsHTTP Connection to the server published with wildcard domain will receive the
Host
header with the connection. If you have wildcard DNS entry, you're supposed to host e.g. wildcard HTTP server so it can just return custom error page for host names that you don't want to serve. If you have wildcard TLS certificate, you can make it work without SNI, too.