Pretty Wordpress Permalinks on IIS 6 Shared Hosting

We all want pretty and search-engine friendly URLs for our blog posts. The most common format is /%year%/%monthnum%/%day%/%postname%/ as it gives users and search engines optimal information about the topic and the month of the post (er, you might want to check out the URL of this post for an example). As it turns out, having Wordpress generate such URLs is possible on IIS 6 in a shared hosting environment without much effort and there is no need to move to an Apache host with mod_rewrite etc. The "official" procedure recommended by Wordpress is here. It entails editing your Windows Server's php.ini file. However, most shared-hosting companies (I currently use Crystaltech) will not do this for the entire server just so that your blog can have pretty URLs. There's a much easier way:

  1. Create a text file in the root of your blog and name it php.ini. Paste the following two lines: cgi.fix_pathinfo = 1 cgi.force_redirect = 0

  2. Then simply change the permalink structure in your Wordpress control panel to: /index.php/%year%/%monthnum%/%day%/%postname%/ To get rid of the leading "/index.php/" -which will make it easier to move to another blog engine such as Typo later-;) follow these additional steps:

  3. Download the Wordpress - Remove Index.php from Permalinks in IIS Plugin (scroll down), and install it into wordpress (upload to /wp-content/plugins/ folder, then Activate from Wordpress control panel).

  4. Change the default 404 error page of your IIS site. Most web hosting companies will offer a web form to accomplish this. At Crystaltech it looks like so:image Set the 404 error URL to "/index.php" or the root URL of you blog such as "/blog/index.php". Then change the permalink structure to /%year%/%monthnum%/%day%/%postname%/. Hope it helps.

SEO Tutorial: Thanks for this post! I thought I have no way for URL structure.... This post helps me a lot. Thanks again.

dirk: @Michael: Sorry, I should have clarified that this article applies to IIS6 as IIS7 wasn't released at the time. If I remember correctly, the setup when I moved to IIS7 was different and much easier and less "hackish", but you need the IIS7 rewrite module installed. The above technique likely won't work with IIS7 because of the new request pipeline architecture. Sorry for not being of more help.

Michael: Well, it didn't work... I don't know why I have spent the past week looking for a solution... I would even settle for the permalinks with index.php in it.... I don't get it. I gave Godaddy IIS7, Wordpress, and I am trying to do this for a subdomain... meaning: (I have other domains under the, but they are ireelevant tot this situation) "Wordpress" contains all of the WP files. "Subdomain1" is the folder where I put php.ini, though when that didn't work, I did try putting php.ini under "Wordpress" Please help!! :( Michael

Sean: Custom 404's while preserving the ability to have permalinks are possible using this hack with a small tweak -- see

Sitaram: You rocks!!.. I have been looking for this and found your page. It worked like a champ.

Thumbs Up! Design: Thanks for this. I don't have access to the IIS folders on my Windows Server 2003 hosting so a solution like this was necessary. Searched a lot of sites and tried a lot of solutions, but only this one worked for me.

mukesh: No need to install any ISAPI filter to remove the index.php from WordPress permalinks.No need of .htaccess file..Use these simple steps to WordPress Permalinks in IIS 6.0 using Custom 404 Redirect for Windows Shared hosting/manas hosting or any windows shared hosting.

Posted: 20 August 2007

comments powered by Disqus