WebDevelopersNotes logo

home-icon Home / HTML / Automatically redirecting visitors to another page

Automatically redirecting visitors to another page

Automatically redirecting visitors to another page

It might so happen that during the web site maintenance process, you might rename a page or move it to another location. One of your kind visitors (rare!) informs you that he/she stumbled on this page and it shows a “404 page not existing error”.
Think about other users who have ‘bookmarked’ this page or worse still, search engines that have indexed this page.

A remedy for this problem would be to use an automatic redirection and we employ the <META> tag to accomplish this job.

Using the http-equiv and content attributes with appropriate values, we can set up this redirection.

<meta http-equiv="refresh" content="10; url=somepage.html">

The <meta> tag has to be included in the HTML head. The content attribute takes two values. The first specifies the number of seconds for the page to refresh and the second is the page URL address. (Note: These two values are enclosed in only ONE pair of quotes and separated by a colon).

The code above redirects the user to somepage.html in 10 seconds.

It is also wise to include a link to the new page in the HTML body section for older browsers that do not recognize the <meta> tag, something like:

The page has been moved <a href="newlocation.html">here</a>

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

JavaScript was initially called LiveScript. The final name change is generally regarded as a clever marketing stunt by Netscape to ride on the popularity of Java, the hot new language at that time. So though the names are similar, JavaScript and Java have little in common. The language was created by Brendan Eich when he was working at Netscape Communications Corporation and it was first included in the beta releases of Netscape Navigator 2.0. Actually, if we go a little further in time, the language was called "Mocha" during development! JavaScript is now one of the most popular languages on the web and the term has been trademarked by Oracle Corporation. In the early days, Microsoft's implementation of the language was JScript. [more...]

We use cookies to give you the best possible website experience. By using WebDevelopersNotes.com, you agree to our Privacy Policy