redirect 404's with .mt script/Location: Header
Sivakatirswami
katir at hindu.org
Mon Dec 24 21:37:01 EST 2001
I am trying to create a MC cgi that will handle 404's and tell the client
browsers (as well as robots/spiders) where to go:
I signed up on the Apache List and someone there said it was as simple as
sending back out to the browser a "Location:" header with no body....
in PERL it looks like this:
=====
print "Location: $URI\n\n";
where $URI is a variable containing the location you want to redirect to.
=========
So, thinking it was that simple I did this:
on startUp
# This MetaTalk script sends a "Location: " header to the browser
# telling the browser where to go to get the correct page
# poke variable with a URI
put "http://www.himalayanacademy.com/" into newURL
# send the header all by itself
put "Location: " & quote & newURL & quote & cr & cr
end startup
Now, the script works to the extent of not generating a server error, but
the browser returns "This document contains no data" i.e. my first take on
this is: the header was not interpreted as a directive, but instead the
browser is trying to render the input from the .mt script... what did I do
wrong?
Sorry, if this crosses the line between a request for HTTP protocol
assistance vs a request for MC assistance.. . I searched all apache Docs for
something clear enough to implement but couldn't find it...
Hinduism Today
Sivakatirswami
Editor's Assistant/Production Manager
katir at hindu.org
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org
Read The Master Course Lesson of the Day at
http://www.gurudeva.org/lesson.shtml
More information about the metacard
mailing list