How to redirect an entire server or directory

One way to redirect all requests for an entire server is to setup a Redirect to a cgi script which outputs a 301 or 302 status and the location of the other server.

By using a cgi-script you can intercept various requests and treat them specially, e.g. you might want to intercept POST requests, so that the client isn't redirected to a script on the other server which expects POST information (a redirect will loose the POST information.)

Here's how to redirect all requests to a script...

In srm.conf,

ScriptAlias / /usr/local/httpd/cgi-bin/redirect_script

and here's a simple perl script to redirect

#!/usr/local/bin/perl

print "Status: 302 Moved Temporarily\r
Location: http://www.some.where.else.com/\r\n\r\n";

Home Index