<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Progressive Development &#38; Hosting</title>
	<atom:link href="http://www.prodevhost.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.prodevhost.com</link>
	<description>Web Hosting and Development</description>
	<lastBuildDate>Tue, 05 Jan 2010 19:56:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rewrite Rules for SEO URL Canonicalization</title>
		<link>http://www.prodevhost.com/search-engine-optimization/rewrite-rules-for-seo-url-canonicalization/</link>
		<comments>http://www.prodevhost.com/search-engine-optimization/rewrite-rules-for-seo-url-canonicalization/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 06:57:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Search Engine Optimization]]></category>

		<guid isPermaLink="false">http://www.prodevhost.com/?p=15</guid>
		<description><![CDATA[The Problem
For Search Engine Optimization (SEO) purposes, it&#8217;s important that search engines have a consistent view of your site.  This is known as URL Canonicalization.  There are many ways in which to get to the same page on most sites.  For example, these URLs all point to the same content:

http://www.example.com/
http://www.example.com/index.html
http://example.com/
http://example.com/index.html

You want search [...]]]></description>
			<content:encoded><![CDATA[<h3>The Problem</h3>
<p>For <a href="http://en.wikipedia.org/wiki/Search_engine_optimization">Search Engine Optimization (SEO)</a> purposes, it&#8217;s important that search engines have a consistent view of your site.  This is known as <a href="http://www.google.com/search?hl=en&#038;q=seo+canonical+issues">URL Canonicalization</a>.  There are many ways in which to get to the same page on most sites.  For example, these URLs all point to the same content:</p>
<ul>
<li>http://www.example.com/</li>
<li>http://www.example.com/index.html</li>
<li>http://example.com/</li>
<li>http://example.com/index.html</li>
</ul>
<p>You want search engines to have only one reference for the content contained in these four different URLs, which are really all the same page. </p>
<h3>The Solution</h3>
<p>Consolidating these down to one URL can be achieved by the use of a <a href="http://en.wikipedia.org/wiki/URL_redirection#HTTP_status_codes_3xx">301 redirect</a>, which indicates that a page has been permanently moved to the location indicated in the redirect.  The &#8220;301&#8243; is an <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Response Status Code</a> that indicates the location of a page has permanently moved.  Search engines pay attention to this code, and theoretically update their indexes accordingly.</p>
<p>If your site runs using the <a href="http://httpd.apache.org/">Apache Web Server</a>, 301 redirects can be implemented with the use of the <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html">mod_rewrite Module, a URL rewriting engine</a> that is available in most installations of the Apache web server.</p>
<p>A complete discussion on mod_rewrite is beyond the scope of this post, but there is <a href="http://www.google.com/search?q=apache+mod_rewrite">no shortage of information to be found on the topic</a>.</p>
<p>So how do you implement this?  Well, that is the main point here.  Assuming your site is running on Apache, you can add the rewrite rules to a .htaccess file in the document root (the main directory) of your site.  A <a href="http://httpd.apache.org/docs/1.3/howto/htaccess.html">.htaccess file</a> can be used to set web server configuration settings that pertain to just your site.  I have seen many examples of mod_rewrite rules meant to fix canonical URL issues, and most fall short somewhere.  Here is a set of rules that has worked many times in the past for me.</p>
<p>To set up the example, we&#8217;ll assume your domain is <strong>example.com</strong>, and that you want search engines to see your site as <strong>http://www.example.com/</strong>.</p>
<h3>The Rewrite Rules</h3>
<p>Lines beginning with # are comments.  They are ignored by Apache, but are helpful in documenting what is going on in the rewrite rules.  Replace all instances of <strong>example.com</strong> with your domain name.</p>
<p>With the disclaimer that we cannot be held responsible for any problems making these changes might introduce, you can add these to an existing .htaccess file or create a .htaccess file in the base directory or your site if one does not already exist.  It is important that this file be plain text.  If this doesn&#8217;t make sense to you, <a href="http://www.prodevhost.com/contact/" title="Contact | Progressive Development &amp; Hosting">contact us</a> and maybe we can help you out.</p>
<pre>
RewriteEngine on
RewriteBase /

# add www to domain if missing
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

# remove index.html for any request
RewriteCond %{THE_REQUEST} ^(.*?\/)index.html
RewriteRule ^(.*?)index\.html$ http://www.example.com/$1 [R=301,L]
</pre>
<h3>The Result</h3>
<p>The effect of adding these rewrite rules will be the following redirections:</p>
<ul>
<li>http://example.com/  &#8211;>  http://www.example.com/</li>
<li>http://www.example.com/index.html  &#8211;>  http://www.example.com/</li>
<li>http://www.example.com/other.html  &#8211;>  no change</li>
<li>http://example.com/other.html  &#8211;>  http://www.example.com/other.html</li>
<li>http://example.com/index.html  &#8211;>  http://www.example.com/</li>
</ul>
<p>This will also work properly with subdirectories:</p>
<ul>
<li>http://example.com/test/  &#8211;>  http://www.example.com/test/</li>
<li>http://www.example.com/test/index.html  &#8211;>  http://www.example.com/test/</li>
<li>http://www.example.com/test/other.html  &#8211;>  no change</li>
<li>http://example.com/test/other.html  &#8211;>  http://www.example.com/test/other.html</li>
<li>http://example.com/test/index.html  &#8211;>  http://www.example.com/test/</li>
</ul>
<p>Again, if you think this is a problem you need to solve with your site and would like some help in solving it, please <a href="http://www.prodevhost.com/contact/" title="Contact | Progressive Development &amp; Hosting">contact us</a>.  For more information regarding SEO or for an analysis of your site, we recommend <a href="http://www.mediawyse.com/" title="San Diego Internet Marketing Consultant - San Diego SEO Consultant">Media Wyse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prodevhost.com/search-engine-optimization/rewrite-rules-for-seo-url-canonicalization/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
