use CGI::Cookie (); use Apache::RequestRec (); use APR::Table (); use Apache::Const -compile => qw(REDIRECT); my $location = "http://example.com/final_destination/"; sub handler { my $r = shift; my $cookie = CGI::Cookie->new(-name => 'mod_perl', -value => 'awesome'); $r->err_headers_out->add('Set-Cookie' => $cookie); $r->headers_out->set(Location => $location); $r->status(Apache::REDIRECT); return Apache::REDIRECT; } 1;