In the site root directory, add:
Web.config:
<?xml version= "1.0" encoding= "utf-8″?>
<configuration>
<system.webServer>
< rewrite>
<rules>
<rule name= "Cnurl" stopprocessing= "true" > "<match url=
"!^ (index\. Php|images|assets|robots\.txt) "/> <action type= Rewrite" url= "cnurl.php"/>
</rule>
<rule name= "Default" patternsyntax= "wildcard" >
<match url= "*"/>
<conditions>
<add input= "{request_filename}" matchtype= "Isfile" negate= "true"/> <add "
{input=}" Matchtype= "Isdirectory" negate= "true"/>
</conditions>
<action type= "Rewrite" url= "index.php" "/>
</rule>
</rules>
</rewrite>
</system.webServer>
</ Configuration>
cnurl.php:
<?php if (isset ($_server[' Http_x_original_url ')) {//IIS mod-rewrite $_server[' request_uri '] = $_server[' HTTP_X_
Original_url ']; else if (isset ($_server[' Http_x_rewrite_url ')) {//IIS isapi_rewrite $_server[' request_uri '] = $_server[' http_x_re
Write_url ']; else {//use Orig_path_info if there no Path_info (!isset ($_server[' path_info ')) && isset ($_server[' ORIG
_path_info ']) && ($_server[' path_info '] = $_server[' orig_path_info ')); Some IIS + PHP configurations puts the script-name in the Path-info (No need to append it twice) if (Isset ' Path_info ']) {($_server[' path_info '] = = $_server[' Script_name '])? ($_server[' request_uri '] = $_server[' Path_info ']): ($_server[' request_uri '] = $_server[' Script_name ']. $_SERVER['
Path_info ']); }//Append the query string if it exists and isn ' t null (isset ($_server[' query_string ')) &&!empty ($_server[' Query_string ']) && ($_server[' Request_uri '). = '? '. $_server[' QUERy_string ']); } require ("index.php");
Support the IIS environment to run a variety of open source PHP projects, such as: Wordpress, Emlog, Typecho and so on.