Search Engine Friendly Redirects – File Level
There are three articles dealing with redirects to handle redirecing one file at a time, redirecting one directory at a time, and redirecting multiple pages easily.
If you are going to move a page you will likely want to redirect visitors to the old page to the new in such a methd that the search engines don’t get confused. Some of the ways they can get confused include:
- Bringing up two copies of the same page. This is likely to trip a duplicate content penalty.
- Using a temporary redirect. This means ‘the page has moved but will be back shortly – don’t update your index’.
A 301 permanent redirect is the redirection method recommended by the major search engines. Using a 301 redirect you are in effect telling the search engines the page has moved and to update their index. It also has the nice side benefit of redirecting the benefit of inbound links to the new page.
Implementing a 301 permanent redirect is different depending on the operating system and/or programming language you are using on your server:
IIS Redirect
- In internet services manager, right click on /old-file.htm
- Select the radio titled “a redirection to a URL”.
- Enter the redirection page.
- Check “The exact url entered above” and the “A permanent redirection for this resource”
- Click on ‘Apply’
Apache Redirect
Create a file called .htaccess in your root directory and add the following line:
ColdFusion Redirect
Edit the file /old-file.htm and put the following code:
<cfheader statuscode=”301″ statustext=”Moved permanently”>
<cfheader name=”Location” value=”http://www.mywebsite.com/new-file.htm”>
PHP Redirect
Edit the file /old-file.htm and put the following code:
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.mywebsite.com/new-file.htm” );
?>
ASP Redirect
Edit the file /old-file.htm and put the following code:
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, ” http://www.mywebsite.com/new-file.htm”
%>
ASP .NET Redirect
Edit the file /old-file.htm and put the following code:
private void Page_Load(object sender, System.EventArgs e) {
Response.Status = “301 Moved Permanently”;
Response.AddHeader(“Location”,”http://www.mywebsite.com/new-file.htm”);
}
</script>
HTML Redirect
Edit the file /old-file.htm and put the following code:
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv=”REFRESH” content=”0;url=http://www.mywebsite.com/new-file.htm”>
</HEAD>
<BODY>Optional page text here.
</BODY>
</HTML>