How to get your own IP address?

The website we launch allows you to register your own URL and redirect to our website in your account. Suppose this is something similar to Blogspot.com, where users can have their own URL.

The problem is that for this we need the static IP address for DNS forwarding to work. We can easily get static IP addresses from most hosting companies, but if we change our hosting company, it means that we will have to force all our users to change the DNS settings to our new IP address. This is very problematic.

Is there a way to own our own IP address that we can take with us wherever we host a hosting company? Or are there other simpler solutions?

+4
source share
3 answers

This can be fixed using DNS. Create a single DNS record "A" that points "your-site.com" to your current IP address. Then, when all your users register their own URL, instead of setting up "A" entries, they need to set up a "CNAME" entry that points to "your-site.com". If your IP address changes in the future, you just need to change the "A" record to "your-site.com" and then all other DNS records will be automatically updated.

+7
source

I would never create a CNAME, something weird and not scalable (another thing) ...

just create a wildcard in your A record named *.yourdomain.com

the normal thing is to create a new domain just for this, for example *.yourdomainaccount.com and work with the example below, so many well-known web services use this technique.

then in your default file or in the web.config file or in any other file of your site configuration, create a simple method that receives the domain, for example Server Variable SERVER_NAME

and then redirect the user to your account.

in c #

 string server = Request.ServerVariables["SERVER_NAME"]; if ( server.Contains("www.") || server.Contains("blog.") ) { // redirect the user to your main site or blog respectively } else { string user = server.Replace("http://","").split(".")[0]; Response.Redirect(String.Format("www.domain.com/users/{0}", user)); } 
+2
source

This is why domain names are useful abstractions. IP can change as long as the domain is registered to a new address. Do some research on dynamic DNS. You will like what you see.

http://www.dyndns.com/

+1
source

Source: https://habr.com/ru/post/1307176/


All Articles