最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

IIS環(huán)境下PHP rewrite重寫設(shè)置(支持中文參數(shù))

 更新時(shí)間:2014年06月27日 22:39:04   作者:W3log  
這篇文章主要介紹了IIS環(huán)境下PHP重寫設(shè)置 支持中文參數(shù),需要的朋友可以參考下

在網(wǎng)站根目錄下加入:

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="{REQUEST_FILENAME}" 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_REWRITE_URL'];
} else {
  // Use ORIG_PATH_INFO if there is 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($_SERVER['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");

支持IIS環(huán)境下跑各種開源PHP項(xiàng)目,如:Wordpress、Emlog、Typecho等。

相關(guān)文章

最新評(píng)論

剑川县| 沁水县| 交城县| 陕西省| 恩平市| 成武县| 米易县| 宜阳县| 隆回县| 吉林市| 曲靖市| 津市市| 冷水江市| 乌恰县| 营山县| 交城县| 雅安市| 马龙县| 方山县| 宣汉县| 灵山县| 宜都市| 乡城县| 东莞市| 民丰县| 佛教| 浦江县| 宁国市| 五原县| 杭锦后旗| 禄丰县| 万荣县| 池州市| 南京市| 铜山县| 潢川县| 东平县| 新竹县| 华坪县| 巴彦县| 泸定县|