tesserakt
tesserakt

Reputation: 3331

Can I use domain masking plus get the URI passed?

I have a dyndns.org account which goes to my home computer. That all works fine, wordpress is installed.

I want to buy a domain (mysite.com) and have it mask to mysite.dyndns.org while passing back all of the additional URI goodness.

For example, if I go to mysite.com/page2 it should go to mysite.dyndns.org/page2

Any thoughts on ways to accomplish this?

Upvotes: 0

Views: 107

Answers (2)

tesserakt
tesserakt

Reputation: 3331

The answer turned out to be to use a CNAME record. CNAMES essentially act like symlinks.

Upvotes: 1

Michael Aaron Safyan
Michael Aaron Safyan

Reputation: 95639

Yes, assuming you want to keep hash parameters in addition to query parameters, you could accomplish such a thing with a little piece of JavaScript like the following:

if (window.location.host == 'mysite.com') {
   var current_url = window.location.href;
   var new_url = current_url.replace('mysite.com', 'mysite.dyndns.org');
   window.location.href = new_url;
}

If you don't need to preserve hash parameters, then you could implement similar redirect logic in the web server or in the server-side scripting language of your choice, by checking the HTTP "Host" header for the current host name, and issuing a 301 redirect as needed.

However, I really do not understand why you would want your system to be set up in this way. Typically custom domains are more trustworthy than domains hanging off of "dyndns.org". Why not just have your custom domain configured to point to the correct IP address(es)? Most web hosting solutions will automatically provide the appropriate DNS configuration.

Upvotes: 0

Related Questions