If you are a regular reader of this blog then you probably noticed that the design and layout has changed considerably. The fact is that the changes actually go much deeper than that, as I’ve gone as far as switching the platform entirely. I recently decided to explore other Open Source platforms, and the final choice of blogging platform chosen is BlogEngine.net. I will be sharing my reasons and thought process about this change (and others in the works for other application types) in another blog post.
When moving a blog there are several things that need to fall in place in order to make the transition as smooth as possible. SEO sits high on the priority list, so I started with the task of tweaking the blog’s URL rules.
For this task, since my application servers run IIS 7, I decided to give its freely distributed URL Rewrite extension and give it a fair shot. For your convenience, Microsoft has made the extension available through the Microsoft Web Platform Installer, so getting it up and running is a snap.
Once installed, open the IIS Manager where you should now see the newly installed extension under each of your websites, as shown below:
Please note that this post does not only apply to blogs and BlogEngine.net; you can, and should apply these rules on any website requiring the full benefits of SEO.
In this blog post I will be discussing the 3 rules that I consider the most important when it comes to ensuring that your content is being indexed efficiently.
The screen shot below shows the list of rules as displayed in IIS Manager after they have been defined.
Convert/Force URLs to Lower Case
URLs can be defined in both uppercase and lowercase characters. What this means is that http://www.cto20.com/post/one-function-to-rule-all-urls.aspx is treated as a different page than http://www.cto20.com/post/One-Function-To-Rule-All-URLs.aspx by a search engine, even though they point to the VERY SAME resources and content. The best way to handle this issue is to REWRITE the URL to lowercase and respond to the “old” capitalized version with am HTTP 301 response (Permanently moved).
Here is the rule:
<rule name="Convert to lower case" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
Below is a screen shot of the Edit Rule UI in IIS for the lower case enforcement rule:
Enforce Canonical Host Names
Similar to what we described above, search engines will treat http://www.cto20.com and http://cto20.com as two separate websites. Search rankings are surely going to drop, given that search engines believe that 2 sites should share the benefit of having the same content.
Once again, the solution is quite simple: HTTP 301 Redirect http://cto20.com to http://www.cto20.com.
Note that the rule below includes additional conditions for the antoniochagoury.com domain name, which also points to this blog. In this case, I added two additional conditions where I HTTP 301 redirect all requests to antoniochagoury.com whether prefixed with a www. or not.
<rule name="Canonical Host Name" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true" pattern="^cto\.com$" />
<add input="{HTTP_HOST}" negate="true" pattern="^antoniochagoury\.com$" />
<add input="{HTTP_HOST}" negate="true" pattern="www.antoniochagoury\.com$" />
</conditions>
<action type="Redirect" url="http://www.cto20.com/{R:1}" redirectType="Permanent" />
</rule>
Below is a screen shot of the Edit Rule UI in IIS for the canonical host names enforcement rule:
Even More Canonical Host Name
Similar to what we described above, search rankings will suffer and drop, if search engines believe that 2 sites share the same content. Incidentally, search engines also think that http://www.cto20.com and http://cto20.com/default.aspx are two separate websites. The right thing to do here, is HTTP 301 redirect the default.aspx page to http://www.cto20.com by applying the following rule.
<rule name="Canonical Host Name - Redirect Default.aspx" patternSyntax="Wildcard" stopProcessing="true">
<match url="default.aspx" />
<action type="Redirect" url="/" redirectType="Permanent" />
</rule>
Below is a screen shot of the
Edit Rule UI in IIS for the canonical host names enforcement rule for the default.aspx option:
All rules described above are applied to this blog site. You can verify the rules using the test cases below:
More information and reference for version 2.0 of the URL Rewrite extension, can be found here: http://learn.iis.net/page.aspx/665/url-rewrite-module-20-configuration-reference/