Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help! problem redirecting using "Location:" header.

12 views
Skip to first unread message

Hulk Hogan

unread,
Mar 15, 1996, 3:00:00 AM3/15/96
to
Hi.

I'm trying to use the "Location: " header to automatically redirect
accesses to web pages, but I'm not having any luck so far.

The set up.
. web server running on non-standard port (8000).

. shell script running on standard www port (80) which
outputs some HTML saying.. "our web server runs on port 8000.
click <A HREF="..."> HERE </A> to go to it." etc etc

It all works well, except that some people forget to include the
":8000" in their URLs, and the shell script on port 80 returns
the same HTML blurb regardless...

So, what I did was to have the shell script read the line sent to
it by the client. This seems to be of the form "GET <page> <method>".

If it was requesting the home page (ie. "GET /" or "GET index.html"
or ...), then I continue to send it the "we're on 8000" HTML blurb.

If it contained anything else, then I wanted to output a redirect
message so the client would automatically get the desired page,
from the real web server running on port 8000.

But so far, all that happens is the client (I've tried Netscape 1.x,
2.x, and lynx) just displays the text.

I've tried outputting the "Location:" header followed by one blank line.
I've tried including a "Status: 302" or "Status: 303" line.
I've tried preceding it with a "Content: text/html".

http://www.boutell.com/faq/redir.htm suggested I need two blank lines,
so I've tried this. And a URI header. And ...

Any ideas?

/\ndy

Kurt J Lanza

unread,
Mar 15, 1996, 3:00:00 AM3/15/96
to
ro...@cltr.uq.oz.au (Hulk Hogan) writes:

>Hi.

>Any ideas?

>/\ndy

The format of the first line of a reply is defined in the
HTTP spec, and must be followed exactly:

HTTP/1.0 302 Found

Leading spaces added for readability. Follow this with the
Location: header, plus any other headers you like, and end
with a blank line. Most relocations also include (after the
blank line) a short HTML document containing an anchor which
someone can click to relocate. This is to accomodate any
browsers out there which don't recongnize the location
header. Hope this helps.
--
--
Kurt J. Lanza <k...@infor.com>

0 new messages