How to automatically forward a page in HTML

by Rob W. on 23 August, 2012

How to redirect a page in HTML

How to automatically forward a page in HTML

The simplest way to forward or redirect an old web page to its new location is by putting the following code to your page….

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv=”refresh” content=”0;url=http://www.where-the-new-page-is-now-located.com”>

</head>
<body>
<p>Put any cool message you want here.</p>

<p>You should also put a link the new page here… just in case it doesn’t refresh.</p>
</body>
</html>


How does it work?

Normally when a viewer arrives at a page, the browser (such as explorer, firefox, safari etc) reads the code of the page and “translates/coverts” it into the page you normally see on your screen (with all the text, images and whirling things that attract your attention).

However when the code above is read by the browser, it will get to the line that says “refresh” and know that it has to go to another page.

The number that appears before the url tells the browser to head to the other page in that number of seconds. In the example above the number is 0 so it will go forward to new page immediately (why make people hang around longer than they should?).

If you put another number there like 5, then the browser will not send you to the new page until 5 seconds have gone by. Sometimes this is useful to leave a message on that page saying something like “Hey we’ve moved this page to another place and we will take you there in about 5 seconds.”

Or if you could always put the classic:

“Our website/page has moved. If you are not automatically redirected to it in 5 seconds, please click on the link below and don’t forget to bookmark the new location.”

And then you would add a link below this to where the new page is (in case the page doesn’t automatically redirect for some strange reason).

Why would you want to forward the page?

Sometimes the “old” current page already has many links to it and is indexed (appears in) search engines like google.

Instead of losing traffic or frustrating visitors placing this redirect code will lead everyone directly to the amazing content you created.

 

Thanks for reading. You will now be forwarded to the new page in 3… 2… 1…
(kidding)

Comments on this entry are closed.

Previous post:

Next post: