Redirecting Your Site Without Hurting Your SEO Ranking

There is two redirect codes you may use, the most commonly used and effective one is called a “301 Permanent Redirect”, this will tell search engine robots and browsers to permanently remember that the page requested has been permanently moved and is not coming back.

You may also use the “302 Temporarily Moved” redirect, which tells robots and browsers, to forward you to the new temporary page, and do not remember this redirect, instead they will keep trying the page and be redirected until the temporary redirect is removed or is changed to a 301 permanent redirect.

Typically when using a 301 permanent redirect, you will even notice your indexed pages in search engines will update the URL to the new one pretty quickly, usually within a few hours, although sometimes it will be a few days.

Also, if you are redirecting a specific page on your website to a new one, most search engines should preserve your rankings and indexing positions for the page, since you are directly telling it via the redirect that it has been permanently moved, and thus is not duplicate content.

A few requirements:

You’re going to need to know what URL path you want to redirect (whether it be a specific page, a folder (and all its pages),  or a whole domain) and where you would like to have the redirect go to.

You’ll also need to know how you plan to handle the redirect, the most common method is via the “.htaccess” file (on Apache web servers), you may also accomplish the same method via a plugin for IIS Web Servers that emulates “.htaccess” file support.

First off, you will need to enable “mod_rewrite” in the “.htaccess” file, via command:

<IfModule mod_rewrite.c>
RewriteEngine On
</IFModule>

By using the IfModule command, you will prevent any ugly “500 Internal Server” errors from displaying, incase that module is not available, although typically it is available and enabled on almost every apache web server by default.

Now for some example redirects that you can utilize in your “.htaccess” file:

[1] Redirect a single page (on the same domain)

Original Page: http://www.example.org/abc/def.html

New Page: http://www.example.org/123/456.html

RewriteRule ^abc/def.html$ /123/456.html [R=301,L]

If you look closely, you will notice we left off the initial forward slash (/) in the first part of the RewriteRule command, and enclosed in what’s called an exact match container (the ^ and $), this tells the web server to only match this exact page to redirect, then the command is followed by the new page, then the type of redirect code to use, in this case it is the “301 permanent redirect”. The “L” means last rule to follow this time.

[2] Redirect a renamed folder (old => new) including all subpages (on same domain)

Old Folder: http://www.example.org/seo-marketing/

New folder: http://www.example.org/search-engine-marketing/

RewriteRule ^seo-marketing/(.*)$ /search-engine-marketing/$1 [R=301,L]

This example will pickup and match any sub file or folder within “/seo-marketing/” on your site, and permanently redirect the robot or browser to the new folder (“/search-engine-marketing/”) with the same exact file or sub folder name.

This is probably the easiest way to rename/move an entire folder on your site to a new one.

[3] How to enforce WWW (to prevent duplicate content, and keep your links clean)

This will redirect anyone who visits your site via just your domain and not via www., to be taken to the www edition of the page, permanently. This prevents duplicate content issues for your SEO rankings and helps keep all your page links very clean.

RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

Make sure you change out “yourdomain.com” for your actual domain, as this is an example, this method preserves the page they wanted too, so they will be taken to the proper page, via the “www” URL.

Additional Methods – You may want to have a script on your website handle a redirect, here’s a few examples written in common web programming languages:

[1] PHP (Linux most common)

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com/some/page" );
?>

[2] ASP.NET (Windows most common)

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

Again, be sure to edit the URL that you want the redirect to go to.

If you have any questions about an example or a situation that I did not cover, please post it in the comments, and I will get back to you with answer to your question.

Comments

By Aurora Brown

Aurora Brown is the Social Media Manager and Editor-in-Chief for Authority Domains online marketing company. She currently authors the Authority Domains Search Engine Marketing Blog and is working on her first novel.

Leave a comment