What is Auto-Redirecting
Auto-redirecting is the technique of automatically sending a site visitor to another page once s/he has landed on a page. The other page is often on the same website, but it can be on a different site altogether. In fact, auto-redirecting is used when a website has been set up for the sole purpose of ranking highly in the search engines. When visitors arrive at a page on the site, from a listing in the search engine results, they are automatically redirected to the main site.
On-site auto-redirecting is common when a page, within the site, has been created specifically to rank highly in the search engines, but has been so highly optimized that it is no good for people to actually see. Auto-redirecting takes visitors to the ‘proper’ page within the site.
Both of those uses are not wanted by the search engines, and they sometimes penalise a page or site for doing it. Fortunately, the engines are not able to automatically detect most of the auto-redirecting methods.
The engines are not against auto-redirecting when it is done for they what consider to be a valid reason. E.g. when you have posted a message in a forum, you often get a confirmation page which will wait a few seconds and then auto-redirect you to the messages.
Auto-Redirecting Methods
The “Meta Refresh Tag” method. Html redirect code
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 html redirect code for it must be in the <head> section of the page, and looks like this:-
<head>...head section stuff (Title, Description,etc.)...<meta http-equiv="refresh" content="5;url=pagename.html"></head>
The “content” parameter contains two parts, seperated 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 immeditate 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 <head> section so that it runs as soon as the page begins to load. This is a typical example:
<head><script language="javascript"><!--location.replace("pagename.html")//--></script>...other head section stuff (Title, Description,etc.)...</head>
“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 occurence of the Back button taking a person back the auto-redirecting page, which immediately takes him/her forward again.
The “Form” method
Spiders can’t fill form fields in, and so they make no attempt at submitting forms, which means that forms can be used for auto-redirecting.
What isn’t generally realised about forms is that the URL in a form’s ‘action’ parameter is just a URL that the browser requests from the server. It is given special treatment by the browser by adding some name=value pairs to the requested URL, but if none exist, the browser will still make the request for the URL.
Javascript can be used to submit the form as soon as the page begines to load. Here is what a Javascript automatic form submission looks like, together with the form to submit:
<head><script language="javascript"><!--document.myform.submit()//--></script>...other head section stuff (Title, Description,etc.)...</head><body><form name="myform" action="pagename.html" method="get"></form>
…rest of the page…
“myform” can be any name and “pagename.html” can be any absolute or relative URL.
Summary
If a few seconds delay is acceptable to the functioning of the site, then the Meta Tag Refresh method of auto-redirecting is by far the best one to use, because search engines don’t object to it.
If an instant redirect is necessary, or if the page to be redirected from should not be seen by people, then one of the other methods should be used, the most common being the Javascript method.
More information about auto-redirecting…
Search Engine Optimization Spam – Auto-Redirecting