redirect 404's with .mt script/Location: Header

Chipp Walters chipp at chipp.com
Fri Dec 28 17:53:01 EST 2001


You might try putting the following in a simple HTML response:

<html>
<head>
<script language=javascript>
location = "http://www.altuit.com/webs/altuit/AltuitMain/default.htm";
</script>
</head>
</html>

where location is the destination you wish to send the user.

-Chipp

-----Original Message-----
From: metacard-admin at lists.runrev.com
[mailto:metacard-admin at lists.runrev.com]On Behalf Of Sivakatirswami
Sent: Monday, December 24, 2001 8:35 PM
To: Metacard List
Subject: redirect 404's with .mt script/Location: Header


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

_______________________________________________
metacard mailing list
metacard at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/metacard




More information about the metacard mailing list