Pretty WordPress Permalinks on IIS 6 Shared Hosting

Blogging Software Add comments

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:

  1. 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).
  2. 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.
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

7 Responses to “Pretty WordPress Permalinks on IIS 6 Shared Hosting”

  1. SEO Tutorial Says:

    Thanks for this post! I thought I have no way for URL structure…. This post helps me a lot.

    Thanks again.

  2. Michael Says:

    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:

    http://www.main.com/subdomain1/wordpress
    (I have other domains under the http://www.main.com, 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

  3. dirk Says:

    @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.

  4. Sean Says:

    Custom 404′s while preserving the ability to have permalinks are possible using this hack with a small tweak — see http://dotnetyuppie.com/2009/09/21/permalinks-and-mod_rewrite-headaches-in-wordpress-with-iis/

  5. Sitaram Says:

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

  6. Thumbs Up! Design Says:

    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.

  7. mukesh Says:

    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.

    http://dotnetcodebytes.blogspot.com/2011/11/remove-indexphp-from-wordpress-on.html

Leave a Reply