Overall RatingNo Ratings
Value for the $No Ratings
EffectivenessNo Ratings

Automatic URL Rewrites: non-www to www and index.html to .com

Automatic URL Rewrites: non-www to www and index.html to .com - Instructions on How to Fix Canonical URLs.

What are Canonical URLs?
When a web site has two or more versions of a URL for the same page. For instance, here are FOUR different ways to see a home page: http://www.yoursite.com, http://yoursite.com, http://www.yoursite.com/index.html, and http://yoursite.com/index.html . See the four differences?

Why are Canonical URLs a Problem?
Reason One: Some search engines have difficulty determining which version is the correct version, and can think you are duplicating content on your website. This could (rarely) get your website penalized or banned, but the real problem is that it splits up your link popularity. The amount of links coming into your page play an important role in how well the page is ranked, especially on Google. So spreading out the incoming links over four versions of the same page is not optimal. Instead, you want to focus all links into the same URL so it has the highest possible link popularity score (page rank).
Reason Two: The computers at Google, MSN, Yahoo and other major search engines are CHOKING on the Internet. Seriously, there are too many pages on the world wide web and their servers are bursting at the seams. Imagine how much room they can save by refusing to index two or four different versions of the same page?
Reson Three: It provides greater usability to your visitors and ensures that they will all bookmark the same version of the URL if you have everything pointing into a single version.

What Can You Do About It?
First, ask your webmaster or hosting company what type of server your site is hosted on. If it is on a Linux server you can upload or make changes to a file called .htaccess in the root directory (the same location where your main page is found on the server) and you can have the problem fixed in moments. To see the effect of properly coded .htaccess file, (links open in a new window) try going to http://firstpagefitness.com, http://firstpagefitness.com/index.html, http://www.firstpagefitness.com/index.html, or any of the inside pages of this site (excluding the blog pages) without the www., such as: http://firstpagefitness.com/about.html . Do you see how the URL automatically changes? Problem solved! (See the end of this blog entry for the code to add into your .htaccess file)

If you are on a non-Linux server it can be a little more difficult, and is not something I can explain in a single blog entry. In this case, I would advise you to make sure ALL links inside your website are pointing to the same page. For instance, if the web site designer used a program like Dreamweaver to design your site, and instead of typing in the entire home page URL (http://www.yoursite.com) they just typed in the file name (/index.html), all of the links inside your website that point to your home page are going to send the user to http://www.yoursite.com/index.html . Instead, you need to have all of those links point to the entire URL, including the http://www., but WITHOUT the file name at the end. This will help let the search engine know which version of the URL you want to be considered your home page. It also makes it more likely that others who link to your site will use the same URL, thus allowing you to focus your link popularity into the single version.

You can copy and paste this code into your .htaccess file if you have one. Otherwise you may need to create one first. Just create a simple text file using notebook, but instead of naming it filename.txt, you name it .htaccess . There is no file name, just the extention .htaccess . NOT htaccess.txt .
The .htaccess Code Needed to Solve Most Canonical URL Issues on a Linux Server:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.html\ HTTP/
RewriteRule index\.html$ http://www.example.com/%1 [R=301,L]

Three Things to Remember:
- Replace example.com with your own domain name.
- If your homepage is something different than index.html (such as index.php or home.html) then replace the index.html part with appropriate file name and extension.
- Always test this out before using on live site and always make a backup of your entire website first.

First Page Fitness is not responsible for your use or misuse of the procedures outlined on this blog. We are qualified professionals with years of experience performing Search Engine Optimization on websites. This blog is provided as a generalized information source for health and fitness professional. If you require search engine optimization and would like to get better rankings on major search engines, we advise you to contact a professional SEO Firm.