Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set up a wildcard (*) subdomain?

I need to serve any of my subdomains

sub1.foo.com
sub2.foo.com
anysub.foo.com

from foo.com

I have successfully added a A record with the * value in WebsitePanel.

Should i make an edit at web.config in my project to enable this feature also?

If i visit for example anysub.foo.com i get the error message

The connection to anysub.foo.com was interrupted.

which i suppose means that something is blocking the response.

How can i fix that? Should i edit the web.config somehow or what?

UPDATE

The site hosted in a shared hosting environment

like image 594
OrElse Avatar asked Aug 29 '15 08:08

OrElse


People also ask

Can you have a wildcard for a subdomain?

A wildcard subdomain is particularly useful if you desire subdomains to display whatever you set as the document root (a designated folder that stores web pages.) Typically, most wildcards are set to the site's homepage out of preference. This should be specified when creating the wildcard subdomain.

How do I create a domain wildcard?

A wildcard DNS record is specified by using a "*" as the part of a domain name, e.g., *. example.com. NOTE: A wildcard DNS record does not cover a root domain (e.g. yourdomain. tld), thus you will need to create a record for @ host additionally.

How do you make a wildcard Cname?

A wildcard DNS record is a record that answers DNS requests for any subdomain you haven't already defined. You can create wildcard A records and CNAME records by entering an asterisk (*) in the Host field when creating a DNS record.


2 Answers

Unfortunately, it is not possible to bind wildcard hosts with IIS on a shared hosting environment. You need to have a dedicated machine with a dedicated IP that handles all incoming traffic, without being bound to a specific domain (i.e. default IIS website handling all incoming traffic).

AFAIK, this feature is not supported in IIS even in version 8.5.

On the DNS side, make sure it's set as a CNAME * pointing to @.

like image 56
santamanno Avatar answered Nov 15 '22 07:11

santamanno


If your website is hosted at WebsitePanel you probably need to use the "Add Web Site Pointer" to make the A record know which Website to use.

(You might also need to remove the previously created A record.)

like image 22
Tubbe Avatar answered Nov 15 '22 06:11

Tubbe