Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As far as how to set up the DNS subdomain wildcard, that would be a function of your DNS hosting provider. This would be different steps depending on which hosting provider you have and would be a better question for them. </p> <p>Once you've set that up with the DNS host, from your web app you really are just URL rewriting, which can be done with some sort of module for the web server itself, such as isapi rewrite if you're on IIS (this would be the prefered route if possible). You could also handle rewriting at the application level as well (like using routing if on ASP.NET). </p> <p>You'd rewrite the URL so <a href="http://myname.domain.com" rel="noreferrer">http://myname.domain.com</a> would become <a href="http://domain.com/something.aspx?name=myname" rel="noreferrer">http://domain.com/something.aspx?name=myname</a> or something. From there on out, you just handle it as if the myname value was in the query string as normal. Does that make sense? Hope I didn't misunderstand what you're after.</p> <p><strong>Edit:</strong> </p> <p>I am not suggesting that you create a subdomain for each user, but instead create a wildcard subdomain for the domain itself, so <em>anything</em>.domain.com (basically *.domain.com) goes to your site. I have several domains setup with <a href="http://www.mydomain.com/" rel="noreferrer">mydomain</a>. Their instructions for setting this up is like this: </p> <blockquote> <p>Yes, you can configure a wild card but it will only work if you set it up as an A Record. Wildcards do not work with a C Name. To use a wildcard, you use the astericks character '*'. For example, if you create and A Record using a wild card, <em>.domain.com, anything that is entered in the place where the '</em>' is located, will resolve to the specified IP address. So if you enter 'www', 'ftp', 'site', or anything else before the domain name, it will always resolve to the IP address</p> </blockquote> <p>I have some that are setup in just this way, having *.domain.com go to my site. I then can read the base URL in my web app to see that ryan.domain.com is what was currently accessed, or that bill.domain.com is what was used. I can then either: </p> <ol> <li>Use URL rewriting so that the subdomain becomes a part of the query string OR </li> <li>Simply read the host value from the accessed URL and perform some logic based on that value. </li> </ol> <p>Does that make sense? I have several sites set up in just this exact way: create the wildcard for the domain with the DNS host and then simply read the host, or base domain from the URL to decide what to display based on the subdomain (which was actually a username) </p> <p><strong>Edit 2:</strong> </p> <p>There is no way to do this without a DNS entry. The "online world" needs to know that name1.domain.com, name2.domain.com,...,nameN.domain.com all go to the IP address for your server. The only way to do this is with the appropriate DNS entry. You have to add the wildcard DNS entry for your domain with your DNS host. Then it's just a matter of you reading the subdomain from the URL and taking the appropriate action in your code. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload