redirect.cgi test page

This document is used to test and demonstrate an installation of Art Sackett's redirect.cgi Perl script for CGI browser redirection. This page may be used to test your own installation, as it is included in the archive distribution -- you will first have to edit the paths within the anchors to accomodate your installation. If you are not viewing the version that is online at and have not edited the HTML of this document, tests may fail -- and you may be looking at an outdated version. This document applies to Version 0.91, the second public release.





redirect.cgi in it's simplest installation does nothing more than handle the output of an HTML form that contains a list of several destination URL's by telling the visitor's browser that it should retrieve the user-selected URL. Either the GET or POST method may be used. The script will refuse to cooperate if it detects that it is not being called from a document that originated on the server it is installed on. This prevents, as much as possible, others from covert nefarious behavior and stealing your server resources. Unlike the previous version, you cannot selectively allow other domains to make use of your script.

redirect.cgi can also be used to create the form element within the HTML document, if the hosting server supports Server Side Includes ("SSI"). redirect.cgi can generate the HTML on the fly using an external list of option/value pairs consisting of the URLs to be retrieved and the corresponding text to be displayed in the popup menu.

A representative sample of the modes of operation available is presented below.

Without SSI, simple operation:

This form uses the GET method. The HTML markup for the form element was written into the HTML of this document.


Please choose a destination:

With SSI, redirect.cgi generates HTML on the fly:

This form uses the POST method (but could have just as easily used the GET method). The HTML markup for the form element was generated dynamically by the action of redirect.cgi which was called from an SSI directive in the markup of this page. The same script both generates the form and processes it when it's used. Because the script only generates the minimum necessary HTML, you can include its output in your own markup to get the look you want.

The SSI directive that caused the inclusion of the above form is:

<!--#include virtual="/cgi-bin/redirect.cgi?method=post&extlist=list.txt" -->

There are several options available for controlling the HTML generated by redirect.cgi. By changing the arguments passed to it in the SSI directive, you can control:

Here is what the form element looks like with all of the options defined:

The SSI directive that caused the inclusion of the above form is:

<!--#include virtual="/cgi-bin/redirect.cgi?method=post&text=bolditalic&label= This is an UGLY Button! &button=left&extlist=list.txt" -->




Each of the above forms is fully functional on the web site. To alter this page for use on your site, you will have to ensure that SSI is possible and configured to parse this document, and you may have to edit the path within the SSI directives to match the installation of redirect.cgi on your site. (In the download version of the package that contains this document, the path is set to cgi-bin/redirect.cgi and the script is named redirect.cgi.) (The included via SSI portions of this page will not appear if you are viewing this page without it having been served to you by a properly configured HTTP server, and the form(s) will not function if there is no redirect.cgi installed on a properly configured server at the URL indicated in the HTML forms.) A brief introduction to Server Side Includes, SSI for the Rest of Us is available in the grey papers that can be accessed using the form(s) above. Please do not contact with questions regarding SSI unless and until you have followed the instructions for installing this script painstakingly and have read SSI for the Rest of Us and just as painstakingly followed the instructions there. This is, after all, a free script that comes with no guarantee.


grey papers
[online only]
Art Sackett - Internet Applications/Perl Developer
[online only]


If you encounter what appears to be a bug in redirect.cgi and/or would like to hire Art Sackett to develop custom perl programs, feel free to contact Art Sackett.