与我们合作

我们专注:网站策划设计、网络多媒体传播、网站优化及网站营销
主营业务:网站建设、微信小程序开发、网络运营、云产品·运维解决方案

有一个品牌项目想和我们谈谈吗?

您可以填写右边的表格,让我们了解您的项目需求,这是一个良好的开始,我们将会尽快与您取得联系。当然也欢迎您给我们写信或是打电话,让我们听到您的声音。

您也可通过下列途径与我们取得联系:

地 址: 西安市高新区科技2路65号清华科技园D座1201

座 机: 029-88811692

手 机: 189 9136 7891

邮 箱: yunlangkeji@126.com

网 址: https://www.yunlang.cc

快速提交您的需求 ↓

iis下常用程序的伪静态规则列表(包括wordpress、thinkphp)

作者:网站建设 | 发布日期:2021-01-29 | 浏览次数:

shopex discuz2.0 discuz2.5 discuz3.x 淘宝客 ecshop phpwind参照http://www.west.cn/faq/list.asp?unid=797通过主机面板设置即可

wordpress设置:

第一步:

 1.新建一个“chineseurl.php”文件:在里面写入以下代码上传到wordpress安装目录。

<?php
// 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
{
// Use ORIG_PATH_INFO if there is no PATH_INFO
if ( !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']) ) {
if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
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'];
}
}
require("index.php");
?>

第二步:

 1.新建一个文件命名为:web.config,在里面写入以下规则(该规则适用wordpress后台默认标签前缀和分类目录都未更改。):

<?xml version="1.0" encoding="UTF-8"?>
  <configuration>
   <system.webServer>
     <rewrite>
       <rules>
         <rule name="ChineseURL" stopProcessing="true">
          <match url="^(.*)$" />
          <conditions>
             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
           </conditions>
          <action type="Rewrite" url="chineseurl.php"/>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

 2.默认的标签前缀和分类目录前缀有更改的情况下,规则如下

<?xml version="1.0" encoding="UTF-8"?>
   <configuration>
     <system.webServer>
      <rewrite>
        <rules>
          <rule name="ChineseURL" stopProcessing="true">
          <match url="^(tag|category)/(.*)$" />
          <action type="Rewrite" url="chineseurl.php"/>
        </rule>
        <rule name="wordpress" 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>

 注意:"<match url=”^(tag|category)/(.*)$" />”需要根据实际目录来修改,假如安装在blog目录,则应改为“<match url=”^blog/(tag|category)/(.*)$” />” 标签前缀和分类目录名称根据实际目录修改。


Thinkphp伪静态规则:

 手工创建web.config文件到站点根目录

<?xml version="1.0" encoding="UTF-8"?>
   <configuration>
     <system.webServer>
       <rewrite>
         <rules>
            <rule name="Imported Rule 1" stopProcessing="true">
              <match url=".*\.(?:gif|jpg|png|css|js|txt|jpeg|swf|flv)" />
             <action type="Rewrite" url="{R:0}" />
           </rule>
            <rule name="Imported Rule 2">
             <match url="/httpd(?:\.ini|\.parse\.errors)" />
              <action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
            </rule>
           <rule name="Imported Rule 3" stopProcessing="true">
              <match url="^(?!/index.php)(?!/admin.php)(.*)$" ignoreCase="false" />
              <conditions logicalGrouping="MatchAll">
              <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              </conditions>
             <action type="Rewrite" url="/index.php/{R:1}" />
           </rule>
        </rules>
      </rewrite>
   </system.webServer>
</configuration>

GO 欣赏案例
查看经典案例

TOP

在线客服

电话咨询

在线客服 获取报价 免费电话
获取报价
您的称呼:

*

公司名称:

电话:

项目主题:

项目描述:

重要的事情,电话里聊

接通客服

不方便的时候线上咨询,在线等哦