Keyboard Face

when you find QWERTY imprinted on your cheek - it's time to go to bed.

Tags

asp CSS css menus dreamweaver flash gallery2 hosting iis7 Javascript jquery jquery ui left mac mssql os9 php printer rdp SEO sql sql server windows wordpress

Update for WordPress Permalinks on IIS

September 7, 2007 by Tom 56 Comments

There has been quite a bit of comments going back and forth on the code that I wrote to enable permalinks for WordPress on IIS since I put it up on the site. Just recently, Einar Egilsson posted an extremely helpful bit a code in the comments. It’s a much better and cleaner way of accomplishing the same thing.

I was always aware that my solution was a little odd in that it used ASP. WordPress is written in PHP and to use ASP requires odd work-arounds. Einar gave us a great simple solution that uses PHP. It too requires 404 redirects, though.

It’s requirements are:

  • IIS for Windows
  • WordPress
  • Ability to change your 404 error page with your web host.

To install, copy and paste this text into a file named wp-404-handler.php:

< ?php
$qs = $_SERVER['QUERY_STRING'];
$_SERVER['REQUEST_URI'] = substr($qs, strpos($qs, ':80')+3);
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
include('index.php');
?> 

Next set the 404 error page to /wp-404-handler.php. If it gives you a choice between file and url, choose url.

Lastly, make sure you enable permalinks in the WordPress control panel under Options > Permalinks.

That should do it.

Thanks to Einar for posting this in the comments and thanks to CaptainN who first wrote about in the WordPress support forums.

Filed Under: Installing Wordpress

Comments

  1. Ivo says

    September 10, 2009 at 9:46 am

    Scratch my previous cry for help, Einar helped me out with his post. Now the problem is that any other 404 on my whole website (that is not my blog) is a blank page. Anyone have a solution for this?

    blog: http://www.seabrookwa.com/blog
    website: http://www.seabrookwa.com

    THANKS!

  2. Ivo says

    September 10, 2009 at 4:32 pm

    I followed your instructions and it worked. However, now the blog’s main page shows me my sidebar while the individual post pages only have the post text and not the sidebar.

    Any ideas on why that is?

    THanks!

  3. Mujtaba says

    September 13, 2009 at 6:48 am

    hi thanks for the code, it worked like a charm!

    i want to know if its possible to write a custom 404 page which can handle bbpress permalinks as well as wordpress permalinks in the same 404 file. iam running the forum at mywebsite/forum

    thanks

  4. Sean says

    September 21, 2009 at 8:18 am

    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. Andy Boyns says

    December 11, 2009 at 11:37 am

    “Be aware though that as this currently stands it does prevent you from using $_POST and $_GET as Hep pointed out above. So if you have a contact form or something similar that requires this then this solution wont work for you.”

    Has anyone any idea how to make this work. I need to use qTranslate, and this requires me to use ?Lang=TR

  6. Iris Isac says

    March 5, 2010 at 11:02 am

    Thanks a ton for this solution. I had seraching a lot for it and now I am using it in WordPress thesis theme with IIS. HHowever I have a problem, when I go to individual post the page is refreshing again and again. I am not able to resolve it. Can someone hwlp please?. My Blog is for a tour operator in India @ http://www.irisholidays.com/blog/volunteering-vacations-in-kerala/2010/03/05/

« Older Comments

Leave a Reply Cancel reply

Your email address will not be published.

Pages

  • About Me
  • WordPress Permalinks in IIS using Custom 404 Redirect

Archives

  • May 2019
  • February 2019
  • January 2018
  • May 2016
  • April 2016
  • December 2015
  • November 2015
  • May 2015
  • April 2015
  • January 2013
  • March 2012
  • February 2012
  • December 2011
  • September 2011
  • August 2011
  • November 2010
  • October 2010
  • June 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • September 2009
  • August 2009
  • July 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • November 2008
  • September 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • December 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • January 2007
  • November 2006
  • October 2006
  • September 2006
  • August 2006
  • July 2006
  • June 2006
  • May 2006
  • April 2006
  • March 2006
  • February 2006
  • January 2006
  • December 2005
  • November 2005
  • October 2005
  • September 2005
  • May 2005

ASP.NET Resources

  • Keven Roth’s Code Library
  • Lemon Law

Blogroll

  • Arin Morfopoulos
  • Jamie
  • Physical Therapists

Code Search Engines

  • Koders
  • Krugle

CSS & Design Resources

  • CSS Basics

Other

  • Amazon
  • Car Repair Questions
  • Cool Quizzes
  • Delphi LA
  • Physical Therapy Clinic Directory
  • Quickbooks Questions
  • Secret Santa Game

Site\'s I\'ve Designed or Helped With

  • Area Rugs
  • Dental Implants
  • Dental Website Design
  • FHA Loans
  • Secret Santa Gift Ideas