| 1 |
.TH redirect 8 "23 September 1995" |
| 2 |
.SH NAME |
| 3 |
redirect - simple redirection CGI program |
| 4 |
.SH SYNOPSIS |
| 5 |
.B redirect |
| 6 |
.SH DESCRIPTION |
| 7 |
.PP |
| 8 |
Three steps to set up a redirection: |
| 9 |
.PP |
| 10 |
1. Make sure your web server is set up to allow CGI programs. |
| 11 |
.PP |
| 12 |
2. Make a symbolic link from the file or directory you want to redirect, |
| 13 |
pointing at this program in the CGI bin directory. |
| 14 |
.PP |
| 15 |
3. Add an entry to the file ".redirects" in the directory where your |
| 16 |
http server runs CGI programs. For most servers, this is the |
| 17 |
directory where the given CGI program lives. The format of the |
| 18 |
file is a bunch of lines with a filename, whitespace, and the new |
| 19 |
URL. For example: |
| 20 |
.nf |
| 21 |
/test/oldfile.html http://www.acme.com/test/newfile.html |
| 22 |
.fi |
| 23 |
The easiest way to figure out precisely what filename to put into .redirects |
| 24 |
is to set up the symlink and then click on it. |
| 25 |
You'll get back a "404 Not Found" page which includes the filename |
| 26 |
as received by the redirect program, and that's what you want to use. |
| 27 |
.PP |
| 28 |
You can also add a wildcard specification to redirect whole groups of files. |
| 29 |
For example: |
| 30 |
.nf |
| 31 |
/wildtest/* http://www.acme.com/test- |
| 32 |
.fi |
| 33 |
will cause an access to the /wildtest/somefile.html to be redirected to |
| 34 |
http://www.acme.com/test-somefile.html. (Note that the asterisk need not |
| 35 |
be preceded by a slash.) |
| 36 |
.PP |
| 37 |
Note: this is designed for thttpd (http://www.acme.com/software/thttpd/) |
| 38 |
and using it with other web servers may require some hacking. A possible |
| 39 |
gotcha is with the symbolic link from the old file pointing at this |
| 40 |
script - servers other than thttpd may not allow that link to be run |
| 41 |
as a CGI program, because they don't check the link to see that it |
| 42 |
points into the allowed CGI directory. |
| 43 |
.SH "SEE ALSO" |
| 44 |
thttpd(8) |
| 45 |
.SH "BUGS / DEFICIENCIES" |
| 46 |
.PP |
| 47 |
It would be really cool to have this program look for |
| 48 |
the .redirects file in the same directory as the file being redirected, |
| 49 |
instead of in the binaries directory. Unfortunately, this appears |
| 50 |
to be impossible with the information CGI gives, plus the non-standardized |
| 51 |
but widespread practice of running CGI programs in the directory where |
| 52 |
the binary lives. Perhaps CGI 1.2 will address this. |
| 53 |
.PP |
| 54 |
The wildcard mechanism is very primitive. |
| 55 |
In particular, any characters that follow the asterisk are blithely |
| 56 |
ignored. |
| 57 |
.SH AUTHOR |
| 58 |
Copyright © 1995 by Jef Poskanzer <jef@acme.com>. |
| 59 |
All rights reserved. |
| 60 |
.\" Redistribution and use in source and binary forms, with or without |
| 61 |
.\" modification, are permitted provided that the following conditions |
| 62 |
.\" are met: |
| 63 |
.\" 1. Redistributions of source code must retain the above copyright |
| 64 |
.\" notice, this list of conditions and the following disclaimer. |
| 65 |
.\" 2. Redistributions in binary form must reproduce the above copyright |
| 66 |
.\" notice, this list of conditions and the following disclaimer in the |
| 67 |
.\" documentation and/or other materials provided with the distribution. |
| 68 |
.\" |
| 69 |
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 70 |
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 71 |
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 72 |
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 73 |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 74 |
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 75 |
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 76 |
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 77 |
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 78 |
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 79 |
.\" SUCH DAMAGE. |