I Perl skulle det kunna se ut i stil med detta.
Kod:
#!/usr/bin/perl
if ($ENV{"REQUEST_METHOD"} eq 'GET') {
* * * *$buffer = $ENV{'QUERY_STRING'};
}
else {
* * * *read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
$NewURL = "http://www.nydoman.com";
$URI = $ENV{'REQUEST_URI'};
print "Status: 301 Moved Permanently\nLocation: $NewURL$URI\n";
exit;
Thomas