
HTTP 301 Redirect in ASP.NET
<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(“Location”,”http://www.new-url.com/”);
}</script>
HTTP 301 Redirect in ASP-VBScript
<%@ Language=VBScript %>
<% Response.Status = “301 Moved Permanently”
Response.AddHeader “Location”, “http://www.somacon.com/”
Response.End
%>
HTTP 301 Redirect in PHP
<?php header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: http://www.somacon.com/”); exit(); ?>
HTTP 301 Redirect in ColdFusion
<CFHEADER statuscode=”301″ statustext=”Moved Permanently”>
<CFHEADER name=”Location” value=”http://www.somacon.com/”>
HTTP 301 Redirect in Perl
#!/usr/bin/perl -w
use strict;
print “Status: 301 Moved Permanently\n”;
print “Location: http://somewhere/page.htm\n\n”;
exit;
Redirection with Javascript
<html>
<head>
<script type=”text/javascript”>
window.location.href=’http://www.somacon.com/’;
</script>
</head>
<body>This page has moved to <a href=”http://somacon.com/”>http://somacon.com/</a>
</body>
</html>
Note that they syntax document.location=”; has been deprecated. Use the above code, or alternately, document.URL=”;.
Redirection with META Refresh
<html>
<head>
<meta http-equiv=”refresh” content=”0;url=http://www.somacon.com/”>
</head>
<body>
This page has moved to <a href=”http://somacon.com/”>http://somacon.com/</a>
</body>
</html>
Reference from: http://www.somacon.com/p145.php; Http/1.1 code definitions