iis下伪静态无效解决方法之一

在调用 $_SERVER['REQUEST_URI'] 之前加入以下代码:

//ISAPI_Rewrite 3.x
if (isset($_SERVER['HTTP_X_REWRITE_URL'])){
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
}
//ISAPI_Rewrite 2.x w/ HTTPD.INI configuration
else if (isset($_SERVER['HTTP_REQUEST_URI'])){
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_REQUEST_URI'];
//Good to go!
}
//ISAPI_Rewrite isn't installed or not configured
else{
//Someone didn't follow the instructions!
if(isset($_SERVER['SCRIPT_NAME']))
$_SERVER['HTTP_REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
else
$_SERVER['HTTP_REQUEST_URI'] = $_SERVER['PHP_SELF'];
if($_SERVER['QUERY_STRING']){
$_SERVER['HTTP_REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
//WARNING: This is a workaround!
//For guaranteed compatibility, HTTP_REQUEST_URI or HTTP_X_REWRITE_URL *MUST* be defined!
//See product documentation for instructions!
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_REQUEST_URI'];
}