Tom Lauck’s Deseloper.org

IIS 7, SEO, and You: Part 1 – URL Rewriting

author:

If you currently do not take a technical interest in Search Engine Optimization (SEO) as a developer, you should.  As opposed to Search Engine Marketing (SEM), an effective SEO plan can often only be implemented by a developer becuase of it’s technical nature.  One such optimization is url rewriting.  A few minutes spent searching on Goolgle will uncover what has been going for years in the Apache world with mod_rewrite and .haccess.  The great thing about mod_rewrite is that you have full control over url structure, and essentially the way search bots crawl through your site.  Many have termed .htaccess/mod_rewrite as “the Swiss Army Knife of SEO.”

Some basic rules that most optimiztion plans include is redirecting to a canonical domain, adding a trailing slash, and removing file extensions. Since II7 natively supports url rewriting now, achieving is very straightforward. There are number of methods to do this, but one way is adding some rules to your Web.config file.

Sample rules for cannonical domain redirect, trailing slash, and file extension:

<rewrite>
    <rules>
		<rule name="Redirect To Cannonical Domain" stopProcessing="true">
			<match url="^(.*)$" />
			<conditions>
				<add input="{HTTP_HOST}" pattern="!^example\.com" />
			</conditions>
			<action type="Redirect" url="http://www.example.com/$1" redirectType="Permanent" />
		</rule>
		<rule name="Remove Index Pages" enabled="true" stopProcessing="true">
			<match url="(.*)(index|default)\.(asp|aspx|html|htm)$" />
			<action type="Redirect" url="{R:1}" appendQueryString="true" />
		</rule>
		<rule name="Add Trailing Slashes" enabled="true" stopProcessing="true">
			<match url="^([^.?]+[^.?/])$" />
			<action type="Redirect" url="/{R:1}/" redirectType="Permanent" />
		</rule>
		<rule name="Remove File Ext Reverse" enabled="true" stopProcessing="true">
			<match url="^(.+)\.aspx$" />
			<conditions>
				<add input="{REQUEST_METHOD}" negate="true" pattern="^POST$" />
			</conditions>
			<action type="Redirect" url="/{R:1}/" appendQueryString="true" redirectType="Permanent" />
		</rule>
		<rule name="Remove File Ext" stopProcessing="true">
			<match url="^(.+)/$" />
			<conditions>
				<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
				<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
			</conditions>
			<action type="Rewrite" url="/{R:1}.aspx" appendQueryString="true" />
		</rule>
    </rules>
</rewrite>

Avoiding duplicate content (http://www vs http:// or /pathtofile/ or /pathtofile), reducing Search Engine Ranking Page (SERP) ranking drops with a relaunch or update, and over solid URL structure are just some of the benefits of a good URL rewriting scheme.  Now that IIS 7 has a URL Rewrite as built in component, web applications built on .NET can be ever more powerful.  In the next part of the series, we will look at the new beta of the Search Engine Toolkit for IIS 7.

11 Responses

date: April 16th, 2010

hiya, thanks for the post. Though it’s kinda refreshing to know that everything isn’t always so complicated as some people make it out to seem. Oh well, just my 2 cents.

spoken by: Sonny Arnoux

date: May 15th, 2010

Very good post. Hope to read much more great posts in the near future.

spoken by: backlink seo

date: December 2nd, 2010

Articles are effective to the degree they’re able to tailor on the prospect’s needs. Even if there isn’t a great deal to express on a specific subject matter make it quick as well as succinct and always stay clear of happy talk.

spoken by: Wally Kelsoe

date: December 8th, 2010

What makes an article marketing strategy productive is market reach. Make the most of all web syndication opportunities available and have your thinking distributed.

spoken by: Javier Krough

date: January 3rd, 2011

Good to know you kept everything to a “recommendation” status. Not only will this prevent people from feeling constrained by your prescription, but this will also inspire to deviate and come up with unique approaches.

spoken by: Jamal Melandez

date: January 6th, 2011

It’s good to know that someone took the time to investigate this aspect, even though the conclusion don’t necessarily match my expectations.

spoken by: Robt Kloock

date: December 4th, 2012

“I Am Going To have to visit again whenever my course load lets up nevertheless I am taking your Rss feed so i can go through your web blog offline”

spoken by: Jovani fans

date: December 4th, 2014

I’ll make it short: GREAT SITE! My first day here and I’m very impressed as coming back after a hard day normally would mean … doing nothing. But after reading all this I feel even more energized than in the morning… just fantastic. Keep up the good work and … THANK YOU!

spoken by: Tandy Bingley

date: January 4th, 2015

ada harta, “Yea saya??” “why? ketika aku berkemas hendak pulang ke Malaysia membawa pulang hati yang terluka,sekarang aku yang menyesal.Billy kerut kening.Anne capai handbag atas meja.” Kita pergi rumah nenek ye sayang. manakan aku perlu bekerja, Hakim tak masuk kelas. Dalam hatinya.

spoken by: Jordan 5

date: January 4th, 2015

?? laungnya kuat. Bubur yang dibawanya diserahkan kepada Suri.mak kan ada.hehe2.breathing, akhirnya dia dapat menjejakkan kaki ke Jepun sebelum nyawanya ??” Dengan penuh confidentnya Munzir berkata.”“Kau ni Jasmin,” kata Jasmin termengah-mengah.T.Aku tertanya-tanya.

spoken by: Air Jordan 3

date: November 4th, 2016

I really like your writing style, good information, thanks for putting up :
D.

spoken by: Cara mendidik anak

Leave a Reply

Jun 10 2009