Helping people with computers... one answer at a time.

It's sometimes the case that you'll want one URL to automatically forward to another. We'll look at several approaches to redirecting URLs.

How do I redirect a web page to another? I have a page with a .dk top level domain and one with .com and would like the .dk to automatic forward visitors to my .com domain. I've found 4 lines on the web describing the code but it doesn't work. And can the same be done if you just own the domain name and doesn't have space on a web server?

This is one of those things that I do just infrequently enough that I can never remember the exact syntax, and I end up looking it up again from the last time I did it.

Fortunately there are a couple of ways, depending on what kind of access you have to your domain and/or server, and what kind of functionality your domain registrar or DNS provider gives you.

1. Registration Only; No Server

If all you've done is register the domain, but have not actually provided for a web server to serve up pages from that domain, you'll be relying on the DNS functionality that your registrar has provided. DNS is normally where you tell the world "this domain is at that IP address" (using an A record). Without a server there is no IP address, so you need to do something different.

One common approach is to create a CNAME record. It's similar to an A record except that it says, in effect, "this domain is really that domain". The "catch" if you want to call it that, is that the web server that will eventually serve up pages for this domain must know about it.

For example: "" has a CNAME record to say that it's really "". That at least gets it to my web server. I then had to configure my web server to handle requests for "". I happened to configure it to redirect those requests to "". (See the URL Rewrite discussion at the end of this article for just how that was done.)

"Exactly how that's done will vary based on which DNS provider you happen to be using, which features they happen to expose and how."

Another approach, depending on the features your registrar or DNS provider gives you, is called a "url redirect". That allows you to specify something much like "this domain should redirect to that page". This is also very powerful in a couple of different ways.

Without any server-side work, "" redirects to "". All it took was a URL redirect in my registrar's DNS control panel. Perhaps more interesting is "" which uses a URL redirect to send you instead to "". This actually relies on features supplied by your DNS provider or registrar, so you'll need to check for availability.

All of the steps above involve dealing with your DNS provider. I say "DNS provider or registrar" above because most registrars provide DNS functionality as part of their service these days. What I can't tell you are the specific steps you need to step through to set an "A" record, create a "CNAME" record, or create a "URL redirect". Exactly how that's done will vary based on which DNS provider you happen to be using, which features they happen to expose and how.

Server With Only ".html" Access

If the domain you want to redirect is already pointing at a server on which you can place ".html" files, there's another technique that doesn't require any DNS work at all. It uses HTML to perform the redirection automatically. The technique is typically referred to as a "meta refresh", and is the one who's syntax I keep forgetting.

Here's the entire contents of the page "":

  <title>Ask Leo! - Leo's Answers Latest Newsletter</title>
  <meta http-equiv="refresh" content="0;url=">
   Redirecting to latest newsletter. If you're not redirected within a couple of seconds,
   click here:<br />
    <a href="">Leo's Answers #82 - June 15, 2007</a>

The line of interest is the fourth line that begins with "<meta". The operation is "refresh" which means to "refresh" the current page with the information that follows. The content begins with a zero, which is the number of seconds to wait, and then the URL that you should be taken to. Thus when you visit you'll be immediately redirected to the page containing the current newsletter.

Most of you will, but not all. Meta-refresh can be disabled by the user so the alternate, manual approach is still required. That's why it's important to include the text in the actual page instructing people to "click here if you're not automatically redirected".

In your case I'd put on your home page a meta refresh of the form:

  <meta http-equiv="refresh" content="0;url=">

Servers With URL Rewriting

I'm expecting that the prior methods will be appropriate for 99% of the people who might be interested in the topic. But I feel I have to include this technique for the 1% group - the group that I'm actually in, since this is what I do for most of my sites.

If you have an Apache web server, or another server that supports the same functionality, and it's configured to allow URL Rewriting in .htaccess files or you have access to the configuration files for the web server, then you can do redirection a slightly different way.

First, you would simply point your domain to your web server as if you were actually hosting it there. In your case, you'd go ahead and point your ".dk" domain with an "A" record to your web server.

Then, you would configure your web server to actually host that domain.

Finally, either in the configuration files for that site on your web server, or in the .htaccess file in the root of where the pages for "" would reside, you would place the following:

RedirectPermanent / ""

That'll send all the requests to the redirected target.

(I realize that statement is technically not URL rewriting, but it's close enough for this discussion. Full URL Rewriting is incredibly powerful and complex and well beyond the scope of this answer.)

Article C3063 - June 21, 2007 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

October 4, 2007 4:09 PM

.dk works exactly like (except with advertisements).

Say you wanted to display, then you configure to show (in a similar way to using CNAME i believe), however, will show as a frame, and the URL in the address bar will stay the same as long as you click links that dont open a new webbrowser.

My advice for the person who asked this is to rent a cheap server.
If you cant find one, i highly recommend and go with their $10 plan.

Good luck on your site, and leo: I Know where to come when im stuck on HTML coding now ;) thanks mate.

February 11, 2008 1:12 PM

I know how to redirect to a webpage but what I want is to redirect to a totally different webpage if Primary Redirected page is down. So if PAGE_A is being Redirected to PAGE_B but if PAGE_B is down it should redirect somehow to PAGE_C. Is it possible?

Tom Brown
February 13, 2008 9:03 AM

Mahmood, yes it's possible. That's called Load Balancing...

March 19, 2008 6:13 AM

Is it possible within a table cell on one web page to show the contents of another web page?

Harry Rickards
May 19, 2008 9:26 AM

Yes, thats called an iframe.
Harry Rickards (

October 3, 2008 11:51 AM

Hi, I know how to use the Meta refresh. I've used it on my website to forward everyone to a diferent website.It's nic because it keeps my original domain name in the web browser. does a meta refresh to Unfortunately, if one of the pages on the onestopweb site is longer then the page on, then the page is cut off at the bottom. Also there is a white border around the page. I can make my page size larger on however that makes every page long even if the page on the other site doesn't have anything on it. Is there a simple way around this?
I'm a novice at this and am not sure about the A record and cname stuff.
My domain is hosted through I happened to get in when they were Betatesting and gor my domain and web site free. I could move the domain, but then I would have to start paying a fee to maintain the domain name every year, where Microsoft is currently maintaining the fees. If I change the domain name then I will have to start paying for it. So I'd like to maintain my domain where it's at and forward to a different page. Officelive dosen't offer some of the features that onestopweb offers which I like.


October 12, 2008 4:00 AM

What about cases that I need to get some data in the response from the remote server?
Case of client requesting server1 and him, in turn, request server2 for the data (that needs to go back to the client).


Joel MCLaughlin
November 27, 2008 7:07 AM

Great points and tutorial. In order to transfer any search engine relevance of inbound links you should definitely do a 301 redirect in your .htaccess file.

Joel McLaughlin
Phoenix Search Engine Optimization Marketing

February 4, 2009 9:35 AM

Thanks for the redirect tip. I just put


instead of a manual link. It worked better in my circumstance.

March 14, 2009 9:26 PM

I am using Bravenet and would like to redirect to my new website which is a .com. I did html access which worked when I click "webpage preview in microsoft publisher. But when I put the page into bravenet I get "The webpage cannot be found"

Please Help.

March 19, 2009 1:58 PM


I just bought a domain name from google. I am wondering how to add this domain to an existing page? Thanks!!!

June 24, 2009 2:49 PM

Good information. I generally use 301 redirects for all my domain redirection - it helps forward my retained pagerank of my old domain to my new one.

Calvin Mah
November 25, 2009 11:26 AM

Hi Leo,
Great article.
Question - doesn't the html redirect screw up your page with Google (i.e. de-indexing). I was going to use it but others have warned me against it.
Cheers! Calvin

Unknown. Google doesn't share their secrets. One would hope it would not affect thigns poorly, but there's no way to know for sure. Also be aware that Google's not the only search engine.

May 11, 2010 11:02 AM

Hi, i just did my wedding website from so when i did my save the dates i put www.myname& but when i type it with the Ws it says page not found and then if i type it w/o the Ws then it takes me to my website...what can i do my save the dates are printed with the Ws can i redirect or what can i do ? Help please

dj X
May 13, 2010 6:06 PM

I have a similar question relating to this topic. I've recently acquired ..I wanted to give my friends this link so that they can easily remember, what my problem is the HTML part. I do online radio, what I needed them to do is, when they click or put it would go to my music that instant, so they do not have to go to the server am using ..I've seen them on some blogspot. they have a black square where it says "loading" (appx 100x100 pxl). Can anyone help?
**(the links posted may or may not exist its just an example) any duplication of any website is purely accidental.

Frederick Gella
September 17, 2010 7:37 PM

I cannot understand redirecting at all. Is there a 301 redirect with enom? I purchased domain ( through blogger. I want to 301 redirect every url of to every corresponding url to For example, I want to redirect to But I have not seen a solution about this. Can you help me please?

Aman Srivastava
September 29, 2010 2:02 PM

I want to know how to write html mail.I do have gmail account and knowledge of html.Now please tell me if I type html tags over gmail mail editor program,it simply send content as it is.So,how to do this job so that my html taggged mail present at reciever side as html mail???hope your are get I want to say??

If you click on "Rich Formatting" in GMail's web interface you're writing HTML, but not HTML directly (i.e. you can't enter HTML tags yourself and have them be meaningful). I'm not aware of a way to do that in GMail's web interface - you'd have to use a desktop email program and Gmail's POP3/SMTP interface.

Global iWay
May 22, 2011 3:49 AM

With these capabilities for automatic redirection to other web pages, it is possible to set up a redirection loop -- try to avoid making it a no-wait-time infinite loop! (An infinite loop with a reasonable delay, on the other hand, might have its uses as a sort of slide show, among other possibilities).

March 12, 2012 2:12 PM

I redirected from one URL to the other, the old site now redirect to the site. But the URL name itself is not changing. For example redirected to But the issue is when you go to the hope page of open however the URL name is retain in the address bar.I want when you go to the page redirect and at the same time the URL name changes to

caleb smith
September 17, 2012 12:53 PM

How do I make a domain that has not been published or have any content on it all, it has just been purchased from enom, redirect to a site that i already have set up? The above is really to far advanced for me....I want my domain, to redirect to a page a supplier made for me at see where it talks about CNAMES and I know that is where I need to be, but I dont know how to fill it in to make it do what I want it to

January 13, 2013 5:59 PM

Thanks Leo! I was over-thinking the matter and your article helped simplify my methods. The meta command in the header suggestion worked flawlessly.

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.