当前位置: 首页 > news >正文

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

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>

原文链接:https://www.west.cn/faq/list.asp?unid=800

http://www.lryc.cn/news/26420.html

相关文章:

  • 【Python语言基础】——Python Select From
  • 数据增广真有那么神奇吗?
  • 常用基础硬件知识 - 判断MOS管导通
  • 2023金三银四,测试人还能找到好工作吗?
  • c++构造函数
  • redis 未授权访问漏洞
  • 如何制作一个自定义的winpe?
  • QString转为2进制,8进制,10进制,16进制介绍
  • 2023-3-2-22:01随笔
  • 学习红客技术必备,手把手教你成为“安防第一人”
  • Git系列:常见指令辨析
  • 并发编程实战-构建自定义的同步工具
  • HBase集群部署
  • 网络传输:linux下的网络请求和下载(ping wget curl)、端口
  • 阅读(1)-----六级
  • 【Python实战】快看:”又中奖了,中大奖了“周围的小伙伴都惊呆了~你还不麻溜滴~(代码版彩票小游戏上线啦)
  • 【python】控制台中文输出乱码解决方案
  • 一名IC验证工程师的成长路径是怎么样的?来听听工程师的见解
  • java工具jconsole/jstat学习
  • WSN_1 介绍;部分应用介绍
  • linux常用命令介绍 05 篇——实际应用篇(用 cut、uniq等统计文档里每个关键词出现的次数)
  • 大数据处理学习笔记1.7 Scala类与对象
  • Feign踩坑源码分析 -- 请求参数分号变逗号
  • nginx通用history模式刷新
  • Linux系统安装:Zookeeper
  • cocos2dx+lua学习笔记:UIPageView的使用
  • MyBatis常见面试题汇总(超详细回答)
  • Jvm调优实战笔记
  • JVM 全面了解
  • 阿里开源自研高性能核心搜索引擎 Havenask