IIS 7 Url Rewrite with WordPress

I just switched my site over to yet another web server. This one is running the latest and greatest, IIS 7.5, Windows 2008 R2 x64. Plus I want to do some more testing and playing around with WebSitePanel (WSP). WSP used to be DotNetPanel, then they went open source and now it’s a free control panel for Windows servers. But more on that later.

Since this new server is IIS 7.5 and URL Rewrite 2.0 is installed, I thought I would switch from ISAPI_Rewrite and give it a try. I looked really quick for some guides, and made some rules. The best part is, WordPress after version 2.8 is completely compatible with URL rewrite, AND will even update the web.config for you. How cool is that? Here’s the guide on how to do it from iis.net.


It’s very simple, just make sure to give write access to your web.config.

I’ve always had my domain name rewrite to www, so I added that as well. Another simple rule and the code is below.

                <rule name="Add www" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                        <add input="{HTTP_HOST}" pattern="www.mikesaysmeh.com" negate="true" />
                    <action type="Redirect" url="http://www.mikesaysmeh.com/{R:1}" />

Just change www.mikesaysmeh.com to your website address.

Last, I found this guide and used a couple.


I removed the trailing slash from my URL and enforced lower case. There are a myriad of other rules out there as well, and being that all you need to do is add them to your web.config file, it’s too easy to pass up.

If you need a host to support this all, look no further than the one I work for, www.gearhost.com.

Leave a Comment

Your email address will not be published.