Simple Redirect Form

Last Updated: January 20, 2000

One simple way to allow visitors to easily jump from one section or your web site to another is by using a "redirect" script. A small form and simple CGI can be designed to facilitate such a task. The redirect form and CGI source are presented in two sections below.

  1. The HTML source for the redirect form
  2. Installing the CGI source code


HTML Source for the Redirect Form

The HTML source below represents a simple redirect form. This form can be customized for your Virtual Server by simply changing the URLs and Titles (shown in bold) to the URLs and Titles that correspond to specific documents on your web site.

<html> 
  <head> 
    <title>Redirect Form</title>
  </head> 
  <body> 
  <form method="POST" action="/cgi-bin/library/redirect/redirect.pl">
    <select name="url"> 
      <option value=""> Select a Destination 
      <option value="http://www.alts.net/index.html"> ALTS.NET Home Page
      <option value="http://www.alts.net/virtual/server.html"> Virtual Servers 
      <option value="http://www.alts.net/reseller/"> Reseller Program     </select> 
    <input type=submit name=submit value="Go!"> 
  </form> 
  </body> 
</html>

The form shown above can be modified to automatically redirect when a user has selected an option. This is done by adding a little JavaScript to one line in form above. This addition is show below:

change the line:

    <select name="url">

to:

    <select name="url" onChange="submit(); return true">

If you are unfamiliar with the FORM HTML element, or would like to learn more about forms, the following URL is an excellent resource:

http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/fill-out-forms/overview.html


How to Install the Redirect CGI

To install the redirect CGI on your Virtual Server you will need to do the following:

  1. Download the Redirect Form
    You will need to download the Redirect Form HTML source and store it somewhere in your "usr/local/etc/httpd/htdocs" directory structure. Feel free to customize the form, add graphics, etc. But be sure that the variable name for each input field is not altered.

  2. Untar the Redirect CGI source code
    1. telnet or SSH to your Virtual Server.
    2. change directories to your home directory (type "cd" and hit return)
    3. type "tar -xvf /usr/local/contrib/redirect.tar"
      This will install the redirect.pl file into your "www/cgi-bin/library/redirect" directory.

  3. Customize the Appearance of the Redirect CGI
    It is common to substitute an image for the submit button. An example of such a subsitution is included in the examples shown below.

Once you have completed the installation successfully, you will have a working redirect form like the one shown below (go ahead and test it).

  • Example of Redirect (no auto submit)

    Example of Redirect (no auto submit, submit image)

    Example of Redirect (auto submit)


Copyright © 1996, 1997 Last Modified: 20 January 2000.A Little Technology Shoppe, LLC. All rights reserved. All brand names and product names used on these web pages are trademarks, or trade names of their respective holders.