Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > CGI Redirect to another page

Thread Tools

CGI Redirect to another page

Alan Kennedy
Posts: n/a
[Andrew Chalk wrote]
> What is wrong with meta-refresh?

It is claimed that search engines treat meta-refresh with suspicion. I
don't know if this is true or not. The following article (as an
example, this is just the first link I found when googling for "abuse
meta refresh"), claims that Altavista bans sites that use a meta
refresh period below 30 seconds.

META Refresh And Search Engines


alan kennedy
check http headers here:
email alan:
Reply With Quote
Andrew Clover
Posts: n/a
John J. Lee <(E-Mail Removed)> wrote:

> I know I don't like them "on principle", but what practical problems
> do they cause? Do proper HTTP redirects avoid the "back button trap",
> maybe?

Yes, they do. They are also more widely supported by robots (including
search engine spiders) and older and non-desktop browsers (as well as
newer browsers which can have meta-refresh and/or JavaScript disabled).

An HTTP redirect is an unequivocal statement that a resource is elsewhere,
at a transport level. It can be understood and acted on by agents with no
knowledge of HTML or JavaScript (for example Python's urllib), and can
potentially be used to automatically update links.

Meta-refresh (or, less commonly used, Refresh as an HTTP header) was
designed for re-fetching pages that update themselves, such as webcams.
It's still useful for this, although it has yet to be standardised.

Using meta-refresh or JavaScript for a redirect is really a misuse,
and is needed only:

a. When you need to set a cookie at the same time as doing a redirect.
Some browsers will not allow a cookie to be set in anything but a
'200 OK' response.

b. When your web hosts are exceedingly crappy and don't allow you to
do proper redirects through server config or CGI.

In these cases I prefer to use JavaScript's location.replace() method (which
also avoids the back button trap), combined with a short-delay meta-refresh
as backup and a plain HTML link in the returned page as backup for the
backup (for robots etc).

Alan Kennedy <(E-Mail Removed)> wrote:

> It is claimed that search engines treat meta-refresh with suspicion.
> I don't know if this is true or not.

It's not easy to tell, but Google is known to have 'anti-cloaking' measures
for detecting search engine abuse. Since meta-refresh is commonly used for
sending browsers to a different page than engines, it is possible that
a meta-refresh - likely combined with other indicators Google could find
suspicious - might result in a PR0 block.

More importantly, many robots won't follow a meta-refresh at all. (After all,
they don't want to end up following an infinitely refreshing webcam page.)
So a backup <a> link should always be included.

Andrew Clover
(E-Mail Removed)
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirect to another web page using CGI ? vivekian Perl Misc 1 03-08-2007 05:52 AM
Calling another cgi program using Perl Misc 12 08-28-2006 01:00 AM
Python CGI - Accepting Input, Invoking Another Process, Ending CGI LarsenMTL Python 4 11-04-2004 05:59 PM
Basic Q - Response.Redirect, all redirect to first Response.Redirect statement Sal ASP .Net Web Controls 1 05-15-2004 03:46 PM
How to make a page stay open only for few soconds, then redirect automaticaly to another page NWx ASP .Net 3 02-16-2004 05:21 PM