Make WordPress Core

Changeset 5889


Ignore:
Timestamp:
08/17/2007 03:32:19 AM (19 years ago)
Author:
markjaquith
Message:

Set REQUEST_URI for IIS in more situations. props snakefoot. fixes #3514

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-settings.php

    r5844 r5889  
    2828// Fix for IIS, which doesn't set REQUEST_URI
    2929if ( empty( $_SERVER['REQUEST_URI'] ) ) {
    30         $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI?
    31 
    32         // Append the query string if it exists and isn't null
    33         if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
    34                 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
     30
     31        // IIS Mod-Rewrite
     32        if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
     33                $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
     34        }
     35        // IIS Isapi_Rewrite
     36        else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
     37                $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
     38        }
     39        else {
     40                // If root then simulate that no script-name was specified
     41                if (empty($_SERVER['PATH_INFO']))
     42                        $_SERVER['REQUEST_URI'] = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')) . '/';
     43                else
     44                        $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
     45                       
     46                // Append the query string if it exists and isn't null
     47                if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
     48                        $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
     49                }
    3550        }
    3651}
Note: See TracChangeset for help on using the changeset viewer.