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

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.