2014-04-30

Every once in a while, you have a domain but the hosting is at another party that does not allow setting the “Host header” for name based virtual hosting.

So then you want to redirect the page to the hosting party, preferably with keeping the URL in the address bar.

Some how, when searching how to do this (I do it once every couple of years), I always miss the WikiPedia entry at the bottom of this post.

Basically, there are a couple of ways for this:

frameset

head meta refresh

JavaScript window.location.href (which is different from top.location.href)

Only the first one keeps the current URL in the address bar of the browser. The other ones will show the new target url in the address bar.

Notes:

in HTML5, the noframes part is not allowed any more.

the meta refresh has no extra quotes around the URL, the quotes are around the full text of “0; url=http://TARGET.URL/PATH”

Examples:

Frameset

Head meta redirect

JavaScript

–jeroen

via:

URL redirection: Techniques – Wikipedia, the free encyclopedia.

Cabanova Support: How do i web redirect my domain to another URL ?.

Filed under: Development, HTML, HTML5, Software Development, Web Development

Show more