Don't do that ("break the web"). If it's not there, 404 is appropriate. If you mean it be a 302 or maybe better a 301 (202 doesn't make sense here), then you should do a 302. Don't serve the content from the correct URI under the 404. Your webserver layer is the most efficient way to do this when possible (path translation, etc). Otherwise something along the lines of-
use CGI qw(:standard);
my $new = URI->new(url());
print redirect($new); # 302 by default.