How to setup 301 Permanent Redirect on a specific page

The following instruction will show you how to redirect a specific file on your website to a new location.

When should I use “301 Permanent Redirect”?

HTTP 301 Permanent Redirects should be used when you are about to change page name on a page that has been included in any search engine index. The 301 redirect ensures that search engines and users are directed to the correct page. The HTTP 301 Status Code means that the page has been moved to a new location, permanently.

Permanent Redirects using PHP

Add the following code to your PHP page:

<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newlink.com/");
exit();
?>

301 Permanent Redirect using ASP.Net

Add the following code to your ASP.Net page:

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location",http://www.newurl.com/);
}
</script>

Permanent Redirects in ASP Classic (VB)

Add the following code to your ASP page:

<%@ Language=VBScript %>
<%
' Permanent Redirect
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.newlink.com/"
Response.End
%>

Redirect a specific page using .htaccess on Apache

If your website is running on an Apache server, you can add your redirects to a file named .htaccess (no file extension). Add the code below using a text editor and upload fhe file to your website’s root directory.

RewriteEngine on
Redirect 301 /oldpagename.html http://www.newlink.com/newpagename.html

Permanent Redirects in Internet Information Server (IIS)

Follow these steps to redirect a specific page or folder to a new location:

  1. Open “Internet Information Services (IIS) Manager”, found under “Start > Control Panel > Administrative Tools”.
  2. Browse to the website and file/folder you would like to redirect
  3. Right click on the file/folder and choose “Properties”
  4. Select the “A redirection to a URL” radiobutton (see screenshot below)
  5. Enter the new URL in the “Redirect to:” field
  6. Check the “A permanent redirection for this resource” checkbox
  7. Click on “Apply”

"Configure

More information

HTTP Status Code Definitions
HTTP 301 on Wikipedia
List of HTTP status codes on Wikipedia
301 redirects on Google Webmasters Help

Share this post:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>