
redirect.pl is used to perform URL redirection based on users'
form selections.
The redirect.pl CGI script is installed in the LiveZone public
CGI directory. As the example below demonstrates, this script is invoked
as though redirect.pl was actually in your own /cgi-bin
directory.
redirect.pl accepts input from a FORM (either via METHOD GET
or POST) and sends a 300-level HTTP status code to redirect the browser
to a new URL, based on form selections made by the browser user.
There are two ways to use a FORM in conjunction with this script. Either
method should work fine, just don't use both within the same FORM.
1. A list of URLs with a submit button; the script will find the input called
"url" and redirect the browser to this location.
<FORM METHOD="POST" ACTION="/cgi-bin/redirect">
<SELECT NAME="url">
<OPTION VALUE="http://www.ncsa.uiuc.edu/">NCSA
<OPTION VALUE="http://hoohoo.ncsa.uiuc.edu/">HTTPd
<OPTION VALUE="http://www.uiuc.edu/">U of I
</SELECT>
<INPUT TYPE="submit" VALUE="Go to URL">
</FORM>
2. Multiple submit buttons; the script will find an input NAME that looks
like a URL, and redirect the browser to this location.
<FORM METHOD="POST" ACTION="/cgi-bin/redirect">
<INPUT TYPE="submit" NAME="http://www.ncsa.uiuc.edu/"
VALUE="NCSA">
<INPUT TYPE="submit" NAME="http://hoohoo.ncsa.uiuc.edu/"
VALUE="HTTPd">
<INPUT TYPE="submit" NAME="http://www.ncsa.uiuc.edu/"
VALUE="U of I">
</FORM>
![]() www.livezone.com |
Last Updated January 2007 |