Redirecting a web page can be done in many ways, languages, and sides (both client and server).
Generally, it's better to redirect a web page on the server side, as you will not depend on the (to you unknown) browser.
Using language such as C, Perl, PHP, or JavaScript permits you to make a redirection conditional.
Using Apache permits you to redirect one or more pages using one single regular expressions.
That is, There Is Always More Than One Way To Do It.
The following note applies to all redirect methods, both client and server (taken from the Perl's CGI man page):
One hint I can offer is that relative links may not work
correctly when you generate a redirection to another
document on your site. This is due to a well-intentioned
optimization that some servers use. The solution to this
is to use the full URL (including the http: part) of the
document you are redirecting to.
(A relative redirection works on Apache, but you get a warning message in your log.)
To redirect a web page using C, first be sure that the execution of CGI scripts is permitted in the directory where you want to put the redirect page.
On Apache, use the ExecCGI option.
The directive AddHandler cgi-script .cgi
must also be configured (assuming that you use .cgi as the extension for your redirect script).
No matter if a CGI script is written in C, Perl, or whatever language, execution of CGI scripts must be enabled./>
So the requirements mentioned above (the ExecCGI option, the AddHandler cgi-script .cgi directive) also aplly for Perl CGI scripts./>
The easy-to-remember way:
#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
print redirect('http://www.redantigua.com');