301 redirect » The SEO Hobbyist

If you are using WordPress, Here are some essential plugins

Install the following plugins:

XML Sitemap generator

This plugin creates an XML sitemap dynamically for you every time you make an update to your wordpress blog. The best feature of this plugin is that it automatically notifies all major search engines every time your content changes. This helps you get reindexed quicker with all the major search engines like Google, Bing, Yahoo and Ask.com. It also helps them discover new content because it’s much easier for the crawlers to see the complete structure of your site allowing them to retrieve it more efficiently. The plugin supports all kinds of WordPress generated pages as well as custom URLs.

Redirection

This personally is one of my favorite WordPress plugins available. It is particularly useful if you are migrating pages from an old website, or are changing the directory structure of your current one. Writing customized .htaccess 301 redirects from scratch can be very tricky and cumbersome. It’s also terrifying knowing that one typo could bring down your entire site. This plugin gives you full control of all your redirects, and keeps track of them at the same time. Their dashboard provides usage statistics of each redirect and at the same time it makes it easy to add new ones. Generally, this program helps you tidy up any loose ends your site may have.

Oh, and for the REAL geeks out there – Yes, it can handle regular expressions.

Ultimate SEO

What is the Canonical Domain Issue?

This occurs when there isn’t a Permanent Redirect (301) found at the root level of your domain. If not configured properly, search engines will treat your domain “http://example.com” and “http://www.example.com” as two different sites. This can seriously hurt your rankings! We will use that same domain name in the code examples in this tutorial.

Why is it so Critical?

This issue gets so much attention because it’s such a simple mistake that can hurt your rankings an incredible amount. It also gets written about often because the fix is relatively simple (with the proper instruction).  Follow the instructions below to make sure you get the “Full Credit” from every search engine.

How Can I Check My Website for This Canonical Domains Problem?

The easiest way to test if your site has this issue is to run it through one the following analyzers.

They both will tell you very clearly if there are any canonical domain erros, as well as provide you other information about your domain that is often over looked.

Here’s How to Fix It:

There are many ways to fix the canonical domain issue.  The first example is by using an Apache .htaccess file with the following contents. If your preferred name is http://www.example.com, then add the following to a blank text file named .htaccess, and upload it to the domain root:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]

Conversely, If your preferred domain is http://example.com then your last two lines would be:

rewritecond %{http_host} ^www.example.com [nc]
rewriterule ^(.*)$ http://example.com/$1 [r=301,nc]

If you website is built in PHP, you can fix it with the following code snippet:

<?php
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER['HTTP_HOST']
.$_SERVER['REQUEST_URI']);
}
?>

And Finally, a 301 Canonical redirect using ASP:

<%
If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www."
& Request.ServerVariables("HTTP_HOST")
& Request.ServerVariables("SCRIPT_NAME")
End if
%>

How Can I Verify The Fix?

After making the above changes, re-run your website through the analysers that I linked previously. The fix should take effect immediately.

I hope found this article informative. If you have any questions or comments, feel free to enter them below.

<p style=”padding-left: 30px;”>r