The specified CGI application misbehaved by not returning a complete set of HTTP headers

Date March 16, 2009

By default WordPress uses a query string to identify a post. This is neither search engine friendly nor human friendly. A better way is to use a custom URI to better identify your posts.

Default word press url structure: /?p=1

Customized post url can be as follows:
/index.php/2009/03/sample-post/
/index.php/archive/sample-post/

When you try to change default url of wordpress then you may got an error something like “The specified CGI application misbehaved by not returning a complete set of HTTP headers“.

This error generated because you change the default behaviour of url implementation on IIS for PHP and there were no extension to handle that request. PHP can process customized url but by default; it can not. You have to modify php.ini to use custom url.

Step 1: Generate new php.ini file and place it into your root directory.

Step 2: Modify newly generated php.ini and write following two lines.

cgi.fix_pathinfo = 1
cgi.force_redirect = 0

You’ll create new php.ini for each domain or sub domain that is using custom url structure or if you have access to modify php original ini file then you only modify that and you do not need to create new php.ini file for each domain or sub-domain.

Happy Coding

Related Posts

Tags: , ,

PoorFairInterestingGoodExcellent (6 votes, average: 4.33 out of 5)
Loading ... Loading ...

12 Responses to “The specified CGI application misbehaved by not returning a complete set of HTTP headers”

  1. Rahul said:

    Its really work. Great job saqib.

    Thanks

  2. Ahmed said:

    Thanks God, I got the solution of my CGI error. Thanks you Saqib for your great work.

  3. Pages tagged "engine" said:

    [...] bookmarks tagged engine The specified CGI application misbehaved by not re… saved by 2 others     kewlAkane bookmarked on 03/17/09 | [...]

  4. Joel said:

    is it really working? Can i include php.ini in my own website and IIS can also handle this file?

    If so, it is cooooooooooool.

  5. Hellen CLARK said:

    Nice website, I found you while looking for some blog related search and want to give you a compliment while I was here.

  6. Saqib Ansari said:

    Thanks Hellen

  7. KattyBlackyard said:

    Great post! I’ll subscribe right now wth my feedreader software!

  8. Bruce said:

    Life Saver .. Searched for Days

    php working now

  9. Clinton Poole said:

    Cool, I struggled with this problem for a week, tried everywhere on the web to get it sorted. Almost gave up!. Thanks so much!!!!!

  10. Perrin said:

    Where is the php.ini file located?

  11. Saqib Ansari said:

    You have to create new text file and put given 2 lines in that file and upload it to root directory of you website with name with “php.ini”.

  12. Vicky said:

    I was trying to increase the maximum file upload size and post size with a custom php.ini and had this same error you are talking about here. I tried those 2 lines you have suggested in my custom php.ini and it worked. I find this strange,any ideas on what could be the reason?.

    Thank you for the article though, I bet it saved me from a headache:)

Leave a Reply


Most Rated Posts

Subscribe to Technology Tips

Subscribe to Saqib-Ansari via RSS

Or, subscribe via email: