Set REQUEST_URI for IIS in more situations. props snakefoot. fixes #3514
git-svn-id: https://develop.svn.wordpress.org/trunk@5889 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
49de38ddd1
commit
27c26dcb8e
@ -27,11 +27,26 @@ if ( ! isset($blog_id) )
|
||||
|
||||
// Fix for IIS, which doesn't set REQUEST_URI
|
||||
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI?
|
||||
|
||||
// Append the query string if it exists and isn't null
|
||||
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
|
||||
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
|
||||
// IIS Mod-Rewrite
|
||||
if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
|
||||
}
|
||||
// IIS Isapi_Rewrite
|
||||
else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
|
||||
}
|
||||
else {
|
||||
// If root then simulate that no script-name was specified
|
||||
if (empty($_SERVER['PATH_INFO']))
|
||||
$_SERVER['REQUEST_URI'] = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')) . '/';
|
||||
else
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
|
||||
|
||||
// Append the query string if it exists and isn't null
|
||||
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
|
||||
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user