redirect(8) redirect(8) NAME redirect - simple redirection CGI program SYNOPSIS redirect DESCRIPTION Three steps to set(7,n,1 builtins) up a redirection: 1. Make sure your web server is set(7,n,1 builtins) up to allow CGI programs. 2. Make a symbolic link(1,2) from the file(1,n) or directory you want to redi- rect, pointing at this program in(1,8) the CGI bin directory. 3. Add an entry to the file(1,n) ".redirects" in(1,8) the directory where your http server runs CGI programs. For most servers, this is the directory where the given CGI program lives. The format of the file(1,n) is a bunch of lines with a filename, whitespace, and the new URL. For example: /test/oldfile.html http://www.acme.com/test/newfile.html The easiest way to figure out precisely what filename to put into .redirects is to set(7,n,1 builtins) up the symlink and then click on it. You'll get back a "404 Not Found" page which includes the filename as received by the redirect program, and that's what you want to use. You can also add a wildcard specification to redirect whole groups of files. For example: /wildtest/* http://www.acme.com/test- will cause an access(2,5) to the /wildtest/somefile.html to be redirected to http://www.acme.com/test-somefile.html. (Note that the asterisk need not be preceded by a slash.) Note: this is designed for thttpd (http://www.acme.com/soft- ware/thttpd/) and using it with other web servers may require some hacking. A possible gotcha is with the symbolic link(1,2) from the old file(1,n) pointing at this script - servers other than thttpd may not allow that link(1,2) to be run as a CGI program, because they don't check the link(1,2) to see that it points into the allowed CGI directory. SEE ALSO thttpd(8) BUGS / DEFICIENCIES It would be really cool to have this program look(1,8,3 Search::Dict) for the .redirects file(1,n) in(1,8) the same directory as the file(1,n) being redirected, instead of in(1,8) the binaries directory. Unfortunately, this appears to be impossible with the information CGI gives, plus the non-standardized but wide- spread practice of running CGI programs in(1,8) the directory where the binary lives. Perhaps CGI 1.2 will address this. The wildcard mechanism is very primitive. In particular, any charac- ters that follow the asterisk are blithely ignored. AUTHOR Copyright Š 1995 by Jef Poskanzer <jef@acme.com>. All rights reserved. 23 September 1995 redirect(8)