Auto-Redirecting a web page

Auto-Redirecting Methods

The "Meta Refresh Tag" method

This is the one auto-redirecting method that the engines can automatically detect, or so it is believed. It is also the one method that the engines are perfectly happy with as long as there is a reasonable delay between landing on a page and being redirected from it. At least 5 seconds is recommended.

The code for it must be in the section of the page, and looks like this:-

…head section stuff (Title, Description,etc.)…
<meta http-equiv="refresh" content="5;url=pagename.html">

The "content" parameter contains two parts, separated by a semi-colon. The first part is the delay, in seconds, before the redirection occurs. The second part is the URL to redirect to which, like any hyperlink, can be a relative URL (as above) or an absolute URL.

For search engine optimization purposes, a delay in the auto-redirection is not usually desirable. Using the Meta Refresh Tag with a delay of 0 (zero) seconds is not recommended, because search engines can read HTML, Meta tags are HTML, and people have had penalties from redirecting that way. For an immediate redirect, one of the other auto-redirecting methods is much better.

The "Javascript" method

Javascript auto-redirects cannot be automatically detected by the search engines because they don’t yet parse Javascript. The script can be placed anywhere on the page, but it is best to place it in the section so that it runs as soon as the page begins to load. This is a typical example:-

<script language="javascript"><!–
…other head section stuff (Title, Description,etc.)…

"pagename.html" can be any relative or absolute URL, just like a hyperlink URL.

The use of Javascript’s "replace" function causes the new page to replace the current page in the browser’s Back button’s History list. If a visitor then clicks the Back button to go back to where s/he came from, s/he doesn’t go back to the page with the auto-redirect but, instead, goes to the page before that. It avoids the annoying occurrence of the Back button taking a person back the auto-redirecting page, which immediately takes him/her forward again.

Leave a Reply

Your email address will not be published. Required fields are marked *