Home > Uncategorized > #Smalig #ISAPI url #rewrite in IIS 7/8

#Smalig #ISAPI url #rewrite in IIS 7/8

logo-w-manDuring an upgrade of my server from Windows 2008 / IIS 7 to Windows 2012 , one ISAPI url rewrite that I used did not work. The ISAPI filter appears to be obsolete and unmaintained, so I decided to try and write my own using IIS url rewrite rules, and it turned out to be really easy.


So, the premise of this url rewrite is to make a SEO unfriendly url like abc.aspx?id=10 into /web/id/10/abc.aspx – which is more SEO friendly. The smalig Url rewrite will work with any number of parameters, and this is designed to work with at most 2, but you can expand it, if you have more parameters in your url.

<requestFiltering allowDoubleEscaping=”true”/>
<rule name=”smalig1″>
<match url=”web/([^/]+)/([^/]+)/([^/]+).aspx” />
<action type=”Rewrite” url=”/{R:3}.aspx?{R:1}={R:2}” logRewrittenUrl=”true” />
<rule name=”smalig2″>
<match url=”web/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+).aspx” />
<action type=”Rewrite” url=”/{R:5}.aspx?{R:1}={R:2}&amp;{R:3}={R:4}” logRewrittenUrl=”true” />

The “Allow Double escaping” bit, allows for urls with a plus symbol in them, and if you don’t have this, then you can remove this security exception.


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: