#!/usr/bin/perl use warnings; use strict; use CGI qw/param redirect/; my %REDIRECTS = ( 'abc' => 'http://yoursite.com/abc.html', 'def' => 'http://yoursite.com/def.html', ); my $NOT_FOUND = 'http://yoursite.com/page_not_found.html'; my $dest = param('keywords') && $REDIRECTS{param('keywords')} ? $REDIRECTS{param('keywords')} : $NOT_FOUND; print redirect(-uri=>$dest,-status=>'301 Moved Permanently');