3 IIS7 URL Rewriting Rules for Improved SEO

iis7 rules to improve seo

3 IIS7 URL Rewriting Rules for Improved SEO

iis7When moving a website or a blog there are several things that need to fall in place in order to make the transition as smooth as possible. Search Engine Optimization (SEO) sits high on the priority list. So we put together this article to help you out with some of the tricky aspects.

Before going further, I must inform you that this article only applies to those hosting their sites on Windows.

For this task, since my application servers run IIS 7, I decided to give its freely distributed URL Rewrite extension a fair shot at solving our URL change 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 (URL Rewrite).

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.

1. Convert/Force URLs to Lower Case

URLs can be defined in both uppercase and lowercase characters. What this means is that http://inspectorit.com/tips-tricks/reorganize-and-rebuild-indexes-in-sql-server/

is treated as a different page than http://inspectorit.com/tips-tricks/Reorganize-And-Rebuild-Indexes-In-SQL-Server/ 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:

[code lang="xml"]<rule name="Convert to lower case" stopProcessing="true">
	<match url=".*[A-Z].*" ignoreCase="false" />
	<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />

Below is a screen shot of the Edit Rule UI in IIS for the lower case enforcement rule:

2. Enforce Canonical Host Names

Similar to what we described above, search engines will treat http://www.inspectorit.com and http://inspectorit.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://inspectorit.com to http://www.inspectorit.com.

Note that the rule below includes additional conditions for the inspector.itdomain name, which also points to this website. In this case, I added two additional conditions where I HTTP 301 redirect all requests to inspectorit.com whether prefixed with a www. or not.

[code lang="xml"]
<rule name="Canonical Host Name" stopProcessing="true">
	<match url="(.*)" />
			<add input="{HTTP_HOST}" negate="true" pattern="^inspectorit.com$" />
			<add input="{HTTP_HOST}" negate="true" pattern="^inspectorit.com$" />
			<add input="{HTTP_HOST}" negate="true" pattern="^inspector.it$" />
		<action type="Redirect" url="http://www.inspectorit.com/{R:1}" redirectType="Permanent" /> </rule>

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

[code lang="xml"]
<rule name="Canonical Host Name - Redirect Default.aspx" patternSyntax="Wildcard" stopProcessing="true">
	<match url="default.aspx" />
	<action type="Redirect" url="/" redirectType="Permanent" />

All rules described above are applied to this website in one way or the other. Go ahead, give it a shot.

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/

Antonio Chagoury

Hi, I'm Antonio, Founder and CEO of Maxiom Technology (formerly Inspector IT). I'm a technology executive and entrepreneur who has achieved consistent success in driving growth, generating revenue, and enhancing value in domestic and international markets through technology product innovations.

No Comments

Sorry, the comment form is closed at this time.