[WEB4LIB] Re: url re-direct script

Thomas Dowling tdowling at ohiolink.edu
Tue Oct 6 13:04:57 EDT 1998


> Is anyone using a url re-direct script? I'm looking for a script that
> will automatically connects the user to the new url from the old one.

Early returns from the polls:

> ...<meta http-equiv="refresh"
content="5;url='http://your.server.name.here'">
> ...<META HTTP-EQUIV="Refresh" CONTENT="10;
URL=http://www.whaterver.org/">

Be aware that browsers are free to ignore this http-equiv hack.  They may
do it, they may not, or they may let the user decide.  In any case, you
won't know.  In addition to that little problem, the server will continue
to send this document out with a "200 OK" status, so indexing spiders
probably won't ever notice that the page has moved.

A more robust, reliable solution is to configure the Web server to send
out the actual HTTP header you want.  For help, let us know what version
of what server you have.

Now, having said that, we may not be answering the original question.
There are certainly times when you do want a CGI script to redirect a user
to a new, or at least different, URL.  This should be possible by having
the script print out a location header with an *absolute* URL followed by
a blank line:

#!/usr/bin/ksh
echo "Location:
http://www.somewhere.edu/complete/path/including/trailing/slash/"
echo


(That's "...including trailing slash if necessary")


Thomas Dowling
OhioLINK - Ohio Library and Information Network
tdowling at ohiolink.edu




More information about the Web4lib mailing list