WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] HOWTO: fix problems associated with IIS 7 REQUEST_URI variable (1 post)

  1. chrisn55
    Member
    Posted 5 years ago #

    If your site is running on IIS 7 without the hotfix for the REQUEST_URI problem then you can fix wordpress to address it. Basically IIS 7's FastCGI module has a bug where the REQUEST_URI variable doesn't have the query parameters on the original URI. The result is that comparison of page URI's and other logic that depends on the query params doesn't work. If you control the site the then there is an MSKB hotfix for the issue here, however if you don't then open the wp-settings.php file and locate the following line:

    // Fix for IIS, which doesn't set REQUEST_URI
    if ( empty( $_SERVER['REQUEST_URI'] ) ) {

    and modify it as follows:

    // Fix for IIS, which doesn't set REQUEST_URI or doesn't include QUERY parameters.
    if ( empty( $_SERVER['REQUEST_URI']) || (!empty($_SERVER['QUERY_STRING']) && !strpos($_SERVER['REQUEST_URI'], '?', 0)) ) {

    This fix ensures that if the QUERY_STRING is not empty and the REQUEST_URI doesn't contain a ? then it follows the existing logic. This fix corrects problems with wp-e-commerce and other plugins on IIS 7.

Topic Closed

This topic has been closed to new replies.

About this Topic