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.

http://blogs.iis.net/ruslany/archive/2009/05/16/iis-7-url-rewrite-module-support-in-wordpress-2-8.aspx

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="*" />
? ? ? ? ? ? ? ? ? ? <conditions>
? ? ? ? ? ? ? ? ? ? ? ? <add input="{HTTP_HOST}" pattern="www.mikesaysmeh.com" negate="true" />
? ? ? ? ? ? ? ? ? ? </conditions>
? ? ? ? ? ? ? ? ? ? <action type="Redirect" url="http://www.mikesaysmeh.com/{R:1}" />
? ? ? ? ? ? ? ? </rule>

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

Last, I found this guide and used a couple.

http://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx

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.

This site uses Akismet to reduce spam. Learn how your comment data is processed.