Friday, March 5, 2010

Redirect visitors to a new site or page by using HTML code.

Some times we need to change our web url for various reason. When we change our page or site url visitors don’t know new location. They already linked to this location. Another factor is search engine. Because search ingine is already indexed the page To solve this problem we need to redirect visitors to new location.
From my view to do this its a good habit to replace the page with a new page and put the following html code into new page header section I mean between head Tags of html code.


<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">

The content="0; means delay time of the redirecting the page. I prefer to show some message text for the visitors so that he will understand the reason of the redirecting the page. To show the message first you need to see how many second you need to read the message. If it needs 5 seconds the code will be look like this one :

<meta HTTP-EQUIV="REFRESH" content="5; url=http://www.yourdomain.com/index.html">

Hope it will helps those who are new to web design. At last I want to say one thing that it is not the only way to redirect the page. If you want to know more about this go to www.google.com and search for the details.

Example html code :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta HTTP-EQUIV="REFRESH" content="2; url=http://www.yourdomain.com/index.html">
<title>Your website title</title>
</head>
<body>
Your message text here
</body>
</html>

2 comments: