Redirection

One useful trick to use in CGI programs is called HTTP redirection. You use redirection when you want a CGI program to load another page based on some computed value.

For example, if you have a series of pages specific to a browser—for example, they contain a plug-in that's available only to Netscape browsers under Microsoft Windows—you can send all the Web site visitors to the same URL and have a CGI program redirect them to the correct page, as illustrated in Figure 20.4.

Figure 20.4. One Web site redirecting to another.

To implement a redirection, you need to use the CGI module's redirect function. The redirect function manipulates ...

Get Sams Teach Yourself Perl in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.