1redirect(8) System Manager's Manual redirect(8)
2
3
4
6 redirect - simple redirection CGI program
7
9 redirect
10
12 Three steps to set up a redirection:
13
14 1. Make sure your web server is set up to allow CGI programs.
15
16 2. Make a symbolic link from the file or directory you want to redi‐
17 rect, pointing at this program in the CGI bin directory.
18
19 3. Add an entry to the file ".redirects" in the directory where your
20 http server runs CGI programs. For most servers, this is the directory
21 where the given CGI program lives. The format of the file is a bunch
22 of lines with a filename, whitespace, and the new URL. For example:
23 /test/oldfile.html http://www.acme.com/test/newfile.html
24 The easiest way to figure out precisely what filename to put into
25 .redirects is to set up the symlink and then click on it. You'll get
26 back a "404 Not Found" page which includes the filename as received by
27 the redirect program, and that's what you want to use.
28
29 You can also add a wildcard specification to redirect whole groups of
30 files. For example:
31 /wildtest/* http://www.acme.com/test-
32 will cause an access to the /wildtest/somefile.html to be redirected to
33 http://www.acme.com/test-somefile.html. (Note that the asterisk need
34 not be preceded by a slash.)
35
36 Note: this is designed for thttpd (http://www.acme.com/soft‐
37 ware/thttpd/) and using it with other web servers may require some
38 hacking. A possible gotcha is with the symbolic link from the old file
39 pointing at this script - servers other than thttpd may not allow that
40 link to be run as a CGI program, because they don't check the link to
41 see that it points into the allowed CGI directory.
42
44 thttpd(8)
45
47 It would be really cool to have this program look for the .redirects
48 file in the same directory as the file being redirected, instead of in
49 the binaries directory. Unfortunately, this appears to be impossible
50 with the information CGI gives, plus the non-standardized but wide‐
51 spread practice of running CGI programs in the directory where the
52 binary lives. Perhaps CGI 1.2 will address this.
53
54 The wildcard mechanism is very primitive. In particular, any charac‐
55 ters that follow the asterisk are blithely ignored.
56
58 Copyright © 1995 by Jef Poskanzer <jef@acme.com>. All rights reserved.
59
60
61
62 23 September 1995 redirect(8)