Support » Fixing WordPress » Easy Permalinks in IIS

  • I created a small php script to get “pretty” permalinks working on my site (, and thought I’d share. I created a file called wp-404-handler.php in the root of my wordpress installation (it’s my main root, but this should work in a sub directory as well) and put this in it:

    $_SERVER[‘REQUEST_URI’] = substr($_SERVER[‘QUERY_STRING’], strpos($_SERVER[‘QUERY_STRING’], ‘:80’)+3);

    Then in iis I set a custom 404 handler to redirect (it may not call it that in the various control panels, but that’s what it’s called in IIS) to /wp-404-handler.php . This is also nice because now I have a 404 page that matches the rest of my site.

    I hope this is helpful for someone.

Viewing 5 replies - 1 through 5 (of 5 total)
  • To get permalinks woking on my Win/ISS WP installation I created a php.ini and FTP’d it to my domian’s root. I placed the following inside the php.ini:

    cgi.fix_pathinfo = 1
    cgi.force_redirect = 0

    In the WP permalink options I set up the following virtual site structure:


    This may be helpful for those who cannot access the primary php.ini file in Windows or for those who don’t have direct access to ISS configuration settings.

    This worked great for the permalinks — thank you! This is the most straightforward explanation I’ve found after 3 days of trying to make this work!

    I’m still getting a blank page for my 404s though.

    I asked my web host to point to wp-404-handler.php for the 404. Is there anything else that has to be set up? I’ve got 404.php in my themes folder.

    Thanks for any help you can offer.

    I saw an interesting article on a blog about this and was wondering if anyone tried this:

    Hey everyone. So after wrestling with this for a long time (Window XP sp2, IIS 5.1, PHP latest, WP 2.0, MySql 5) I started digging to figure out why my permlinks weren’t working (after following all your good instructions).

    I ran into this msft article:

    I installed the newer version of urlscan, and turned on the following line in the ini file:
    AllowDotInPath=1 ; if 1, allow dots that are not file extensions

    (the ini file is in : D:\WINDOWS\system32\inetsrv\urlscan on my machine)

    Then refreshing works (be sure to re-install urlscan and restart iis or reboot in order to get it to see the new ini info).

    I hope that helps those who are still stuck with windows + iis & permalinks.

    Last post on this blog:

    Won’t using 404 handlers generate a 404 error for each link clicked? I want to do this but I dont want to mess up the IIS logs.

    Finally, I got it to work on IIS 6 and win 2k3 with this:

    The plugin is here:


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Easy Permalinks in IIS’ is closed to new replies.