Home > Networking, Web > 301 Moved Permanently

301 Moved Permanently

August 20th, 2007 Leave a comment Go to comments

Permanent Redirect with HTTP 301

redirect url in php

<?php
header( “HTTP/1.1 301 Moved Permanently” );
header( “location: http://www.new-url.com” );
?>

redirect url in asp

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently” Response.AddHeader “Location”, ” http://www.new-url.com”
>

redirect url in ColdFusion

<.cfheader statuscode=”301″ statustext=”Moved permanently”>
<.cfheader name=”Location” value=”http://www.new-url.com”>

redirect url 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>

redirect url with htaccess

Create a .htaccess file (if does not exists) in your root directory.
<IfModule mod_rewrite.c>
RewriteEngine On
Redirect permanent / http://www.new-url.com
</IfModule>

redirect url in perl

#!/usr/bin/perl -w
use strict;
print “Status: 301 Moved Permanantly\n”;
print “Location:
http://www.new-url.com\n\n”;
exit;

Redirection url with Javascript

<html>
<head>
<script type=”text/javascript”>
window.location.href=’
http://www.new-url.com’;
</script>
</head>
<body>
This page has moved to <a href=”
http://www.new-url.com”>http://www.new-url.com</a>
</body>
</html>

Redirection url with META Refresh

<html>
<head>
<meta http-equiv=”refresh” content=”0;url=
http://www.new-url.com“>
</head>
<body>
This page has moved to <a href=”
http://www.new-url.com“>http://www.new-url.com</a>
</body>
</html>

  1. No comments yet.
  1. No trackbacks yet.
GoCache - ByREV-Cache v1.0 - live served in : 0.146148 sec (gzip)