wfredk at L5Development
Dec 24, 2001, 10:58 AM
Post #3 of 5
At 05:25 AM 12/24/01 -1000, Sivakatirswami <katir [at] hindu> wrote:
Re: CGI Handling ErrorDocument 404/Redirect to external URI
[In reply to]
>on 12/23/01 8:32 PM, Fred Koschara at wfredk [at] L5Development wrote:
> > At 07:30 PM 12/23/01 -1000, Sivakatirswami <katir [at] hindu> wrote:
> >> I want to use the CGI method of handling 404's and serving alternative
> >> or inform the client browser of the needful. FYI, I am a greenhorn
> >> Apache/CGI writer... but after study of the docs for a few hours I can get
> >> myself this far:
> >> 1) .htaccess file with this
> >> errorDocument 404 /cgi-bin/echo.mt
> >> [.Note, I will be using Metacard scripts and not PERL script for the CGI
> >> work... it's a lot easier and more facile, but the issues are the same]
> > You need to send a "Location:" header to the browser, which is then sent
> > back to the appropriate server by the client. Both Perl and PHP provide
> > similar mechanisms for generating headers (e.g., call header("Location:
> > $URI\n\n") in both languages.) If your Metacard scripts do not provide
> > such a mechanism, you will need to change your programming language.
>Aloha, (I'm in Hawaii) Fred:
>Thanks... well, as we xTalk buffs like to say "You can do anything with
>Metacard, easier" ... i.e. isn't anything, in this case a header, sent to a
>browser just simple a text string? Metacard does have whatever mechanism is
>needed, I just need a complete example of such a "Location:" header. I'll
In the HTTP protocol, the first strings returned by the server to the
browser are the "header" lines, describing what's being sent. The header
lines are terminated by a blank line, followed by the body of the
document. In the case of a "Location:" header, the document body is
empty: The server is telling the browser to go look at a different
location (hence the name). In some environments you will see a string such as
print "Content-type: text/html\n\n";
Here the server is sending a header line; indeed, the last one: The "\n\n"
is a pair of newlines - one ending the "Content-type" header line, the
second one being the blank line indicating the end of the headers. If you
see something like that, replace it with
print "Location: $URI\n\n";
where $URI is a variable containing the location you want to redirect to.
Happy Holidays :)
-- Fred Koschara, President
L5 Development Group
For private sector (commercial) space development, visit
L5 Software Development - "out of this world" sites and software
StudioLines.com - Your place on the Internet for local music
Music, feedback, connections. Tap the power of the Internet!
How much did your last traffic ticket cost you?
ThmIndxr(tm), the *only* HTML thumbnail/indexer you need!
wCapLock(tm), makes CapsLock work like it does on a typewriter
KeywordGo(tm), provides keyword access to your popular pages
BannerAds(tm), join multiple affiliate programs with one banner
My personal Web page is http://www.L5Development.com/wfredk
Stop by some time!
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd