Using Vanilla Forums with IIS 7/7.5 and URL Rewrite

We're running our Vanilla 2 installation on Windows 2008 R2 + IS 7.5 + FastCGI + PHP + MySQL.

Of course, the .htaccess that comes with Vanilla is only going to work on Apache. With Microsoft's commitment to PHP on Windows, and the highly performant FastCGI, IIS gives a var better experience than the WAMP stack, especially with all the other features we get in IIS 7/7.5.

One such feature we get is the URL Rewrite 2.0: - URL Rewrite ( - URL Rewrite Module Configuration Reference (

Gone are the old days when we were required to fall back to a commercial solution like ISAPI Rewrite.

URL Rewrite has a very nice GUI built right into the IIS Manager. I'm pretty sure URL Rewrite is included with the Recommended IIS configuration that the Web Platform Installer sets up. So this is fairly mainstream now. Also, you don't have to have access to the machine (or a dedicated server) to do this. Like Apache's .htaccess, all the Rewrite rules are popped in the Web.Config. Very convenient.

After not having used IIS Rewrite before, I quickly got to grips with the help of the above resources, and after a bit of playing around have Rewrite working very nicely on our Vanilla installation. On we run Vanilla off the root domain, on another domain we run put in a subdirectory. I haven't yet included screenshots as I figured most people want the quick and dirty "get this working for my Vanilla 2 installation", and many on shared hosts won't have access to (or care about) the IIS Manager. Therefore here are the respective Web.Config sections:




This is not only a Rewrite Rule from the "clean" to the "dirty" URL (i.e. / to /index.php?p=) but also a Redirect Rule that will use a 301 redirect your "dirty" URLs to their new "clean" URLs. This means all your links (Google indexed pages) will still work, and Google will update the new URL of the page the next time it attempts to crawl the old version.

After that just enable RewriteUrls in your /conf/config.php

$Configuration['Garden']['RewriteUrls'] = TRUE;