在网站根目录下加入:
Web.Config:
cnurl.php:
if(isset($_SERVER['HTTP_X_ORIGINAL_URL'])){
//IISMod-Rewrite
$_SERVER['REQUEST_URI']=$_SERVER['HTTP_X_ORIGINAL_URL'];
}elseif(isset($_SERVER['HTTP_X_REWRITE_URL'])){
//IISIsapi_Rewrite
$_SERVER['REQUEST_URI']=$_SERVER['HTTP_X_REWRITE_URL'];
}else{
//UseORIG_PATH_INFOifthereisnoPATH_INFO
(!isset($_SERVER['PATH_INFO'])&&isset($_SERVER['ORIG_PATH_INFO']))&&($_SERVER['PATH_INFO']=$_SERVER['ORIG_PATH_INFO']);
//SomeIIS+PHPconfigurationsputsthescript-nameinthepath-info(Noneedtoappendittwice)
if(isset($_SERVER['PATH_INFO'])){
($_SERVER['PATH_INFO']==$_SERVER['SCRIPT_NAME'])?($_SERVER['REQUEST_URI']=$_SERVER['PATH_INFO']):($_SERVER['REQUEST_URI']=$_SERVER['SCRIPT_NAME'].$_SERVER['PATH_INFO']);
}
//Appendthequerystringifitexistsandisn'tnull
(isset($_SERVER['QUERY_STRING'])&&!empty($_SERVER['QUERY_STRING']))&&($_SERVER['REQUEST_URI'].='?'.$_SERVER['QUERY_STRING']);
}
require("index.php");
支持IIS环境下跑各种开源PHP项目,如:Wordpress、Emlog、Typecho等。