How to do Web Redirects in HTML, PHP and PERL CGI
For PHP:
[sourcecode language=”php”]
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.wyzaerd.com/index.html");
exit();
?>
[/sourcecode]
For PERL:
The fast way:
[sourcecode language=”perl”]
#!/usr/bin/perl -Tw
$|=1;
use CGI;
my $cgi_object = new CGI;
my $new_page_url = qq~http://www.wyzaerd.com/index.html~;
print $cgi_object->header(-expires=>"now",’Location’ => $new_page_url,);
exit 0;
[/sourcecode]
OR
The slow way:
[sourcecode language=”perl”]
#!/usr/bin/perl -Tw
$|=1;
print qq#Content-Type: text/html; charset=ISO-8859-1\n\n<html>
<head>
<title>Wyzaerd</title>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.wyzaerd.com/index.html">
</head>
</html>#;
exit 0;
[/sourcecode]
For HTML:
[sourcecode language=”html”]
<html>
<head>
<title>Wyzaerd</title>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.wyzaerd.com/index.html">
</head>
</html>
[/sourcecode]
Leave Your Comment
All fields marked with "*" are required.