Windows服务器下用IIS Rewrite组件为IIS设置伪静态方法
2、将下载的IIS Rewrite 组件解压,放到适当的目录(如 C:Rewrite)下,IIS Rewrite 组件下载http://www.helicontech.com/download-isapi_rewrite.htm,IIS Rewrite 简化版组件下载http://www.newhua.com/soft/71446.htm,下载下来解压后不用安装拷到目录下设置好即可使用。
注:IIS Rewrite简单使用方法介绍:一个功能强大的URL处理引擎,功能和Apache的 mod_Rewrite类似,这个是For IIS版本 可以把像list.asp?id=234 这样的链接映射成 list/234.html 这样就有利于在GG中的排名
完全版(Full)与简化版(Lite)的最大的区别在于可以让每个站点自定义URL重写规则(Rewrite Rule),也就是只要将写好的httpd.ini放在站点根目录,就能使用了。
安装说明:下载后可以解压出 ISAPI_Rewrite.dll ,httpd.ini 这两个文件放到某个文件夹下面,然后在 IIS 站点属性的 ISAPI 中加载 ISAPI_Rewrite.dll 就可以了, httpd.ini 是配置文件里面有例子。如果加载不成功的话 请给 ISAPI_Rewrite.dll 安全属性为完全。
2、在“IIS管理器”里选择网站,右键,属性。
3、选择“ISAPI”,点击“添加”。
4、填入筛选器名称,如“rewrite”。
5、可执行文件下方点击“浏览”,选择刚才解压的Rewrite组件位置,Rewrite.dll。
6、确认选择正确后,点击“确定”。
7、点击“确定”,完成筛选器添加。
8、重启IIS。
9、重启IIS后,再次选择站点,右键,属性,看到如下所示向上的绿箭头,说明 IIS Rewrite 成功添加并运行。
IIS Rewrite 规则设置:
解压后的 IIS Rewrite 组件目录(如 C:Rewrite)中,有一个 httpd.ini 文件,将相应规则写入到这个文件中即可。
1. 安装重写插件Rewrite.dll :
如果你的 IIS 服务器加载过 Rewrite.dll 则可以不用下载。
Rewrite.dll文件:百度搜索关键字:Rewrite.dll 下载
加载 Rewrite.dll
在 IIS 的 Isapi 上添加筛选器
筛选器名称为:re
可执行文件选择 Rewrite.dll 就可以了!
2. 配置 httpd.ini :
打开你的httpd.ini,找到
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/archiver/([a-z0-9-]+.html)1/archiver/index.php?2RewriteRule(.∗)/forum−([0−9]+)−([0−9]+).html2RewriteRule(.∗)/forum−([0−9]+)−([0−9]+).html 1/forumdisplay.php?fid=1/forumdisplay.php?fid=2&page=3RewriteRule(.∗)/thread−([0−9]+)−([0−9]+)−([0−9]+).html3RewriteRule(.∗)/thread−([0−9]+)−([0−9]+)−([0−9]+).html 1/viewthread.php?tid=1/viewthread.php?tid=2&extra=page%3D4&page=4&page=3
RewriteRule ^(.*)/profile-(username|uid)-(.+?).html1/viewpro.php?2=2=3
以上是 Discuz!官方提供的配置代码,注意正则格式。
3. 应用
比如,将read.php?bl_id=123&bu_id=456 伪静态成 /html/123/456.html
可以这样写:
RewriteRule ^(.*)/html/([0-9]+)/([0-9]+).html1/read.php?bl_id=2&bu_id=2&bu_id=
3
要使你的IIS服务器支持伪静态重写,按以下步骤来:
1. 安装重写插件Rewrite.dll :
如果你的 IIS 服务器加载过 Rewrite.dll 则可以不用下载。
加载 Rewrite.dll
在 IIS 的 Isapi 上添加筛选器
筛选器名称为:re
可执行文件选择 Rewrite.dll 就可以了!
2. 配置 httpd.ini :
打开你的httpd.ini,找到
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/archiver/([a-z0-9-]+.html)1/archiver/index.php?2RewriteRule(.∗)/forum−([0−9]+)−([0−9]+).html2RewriteRule(.∗)/forum−([0−9]+)−([0−9]+).html 1/forumdisplay.php?fid=1/forumdisplay.php?fid=2&page=3RewriteRule(.∗)/thread−([0−9]+)−([0−9]+)−([0−9]+).html3RewriteRule(.∗)/thread−([0−9]+)−([0−9]+)−([0−9]+).html 1/viewthread.php?tid=1/viewthread.php?tid=2&extra=page%3D4&page=4&page=3
RewriteRule ^(.*)/profile-(username|uid)-(.+?).html1/viewpro.php?2=2=3
以上是 Discuz!官方提供的配置代码,注意正则格式。
3. 应用 :
比如,将read.php?bl_id=123&bu_id=456 伪静态成 /html/123/456.html
可以这样写:
RewriteRule ^(.*)/html/([0-9]+)/([0-9]+).html1/read.php?bl_id=2&bu_id=2&bu_id=
3
再例:
123.php?id=123
123/id/123
RewriteRule ^123/id/([0-9][0-9][0-9])//123.php?id=/123.php?id=1
or
RewriteRule ^123/id/([0-9]+)/123.php?id=/123.php?id=1
PW的规则:[ISAPI_Rewrite]
RewriteRule ^(.*)-htm-(.*)1.php?2RewriteRule(.∗)/simple/([a−z0−9]+.html)2RewriteRule(.∗)/simple/([a−z0−9]+.html) 1/simple/index.php?1/simple/index.php?2
注:比如互动百科的伪静态,设置方法和这些都是差不多的,学会这个方法了其它的一些系统的伪静态设置都是差不多的,不同的可能就是伪静态的规则设置会不一样。
个人备注:
这里的1,
2, $3就是前一个表达式的匹配值
比如:
^(.*)/simple/([a-z0-9_]+.html)1/simple/index.php?$2
Windows服务器下用IIS Rewrite组件为IIS设置伪静态方法的更多相关文章
- windows 2008 下C#调用office组件访问拒绝的解决方法(failed due to the following error: 80070005 拒绝访问)
"组件服务"- >"计算机"- >"我的电脑"- >"DCOM配置"->找到word->属 ...
- 使用PHPstudy在Windows服务器下部署PHP系统
PHP网站一般运行在Apache服务器上,IIS服务器上也可以运行,但是不推荐,windows服务器上没有集成Apache跟PHP的运行环境,但是借助第三方的软件就能很好的搞定,一般这样的软件有很多, ...
- (搬运)使用PHPstudy在Windows服务器下部署PHP系统
原帖地址:http://www.php.cn/php-weizijiaocheng-406175.html 这篇文章主要介绍了关于使用PHPstudy在Windows服务器下部署PHP系统,有着一定的 ...
- 在WINDOWS服务器下设置MARIADB自动备份的方法
WINDOWS服务器下自动备份有三个步骤 1.首先新建一个.BAT文件里面输入 @echo offset "Ymd=%date:~,4%%date:~5,2%%date:~8,2%" ...
- Tomcat在windows服务器下,将tomcat控制台日志记录到日志文件中
Tomcat在windows服务器下,将tomcat控制台日志记录到日志文件中 在Linux系统中,Tomcat 启动后默认将很多信息都写入到 catalina.out 文件中,我们可以通过tail ...
- windows服务器下配置memcache最大内存值
windows服务器下修改memcache配置要求如下: 1.用内网ip的方式提供web应用服务器调用,不允许直接通过外网调用,如将memcache服务放在192.168.1.168的服务器上 2.修 ...
- phpstudy 安装选择,iis+php组合,如何设置伪静态
如题. 找了半天,终于找到解决方案了. 需要在服务器上安装 Url rewrite 组件. 服务器是64位则安装:rewrite_2.0_rtw_x64.exe 然后添加 web.config配置文件 ...
- windows服务器下iis的性能优化 服务器
IIS性能优化 1.调整IIS高速缓存 HKEY_LOCAL_MACHINE SystemCurrentControlSetServicesInetInfoParametersMemoryCacheS ...
- Windows服务器下的IIS和Apache性能比较
目前最流行的建立网站的服务工具就要属Apache与IIS了.那么他们之间到底哪个性能更好呢?到底哪个工具才是最适合我们的呢?最近我也对这方面的问题进行了一番研究. 如果是基于Linux平台的话,那不必 ...
随机推荐
- HttpServletResponse 之 sendError( )
直接返回http 401状态,提示重新登录 response.sendError(401, "当前账户未登录或会话失效,请重新登录!) HTTP状态码列表: 100Continue继续.客户 ...
- 【实用】巧用For xml 生成HTML代码
可以利用SQL的For xml直接生成HTML结构,比如我想生成如下结构: <li> <img src="..."/> <input type=&qu ...
- 785. Is Graph Bipartite?
Given an undirected graph, return true if and only if it is bipartite. Recall that a graph is bipart ...
- Halcon如何保存仿射变换矩阵
这里我们通过序列化来实现的,如下图,写到硬盘的HomMat2D_1内容和从硬盘里HomMat2D_2读出的内容一致,源代码在图片下方. Halcon源代码: hom_mat2d_identity (H ...
- 使用SKlearn(Sci-Kit Learn)进行SVR模型学习
今天了解到sklearn这个库,简直太酷炫,一行代码完成机器学习. 贴一个自动生成数据,SVR进行数据拟合的代码,附带网格搜索(GridSearch, 帮助你选择合适的参数)以及模型保存.读取以及结果 ...
- PayPal接洽苹果 欲承接手机支付外包
不久前,<华尔街日报>等媒体报道,苹果正计划利用iTunes内部支付功能,推出第三方手机支付服务.美国科技 新闻网站Recode1月30日引述消息人士称,移动支付领军厂商PayPal,目前 ...
- freemarker中空值 null的处理 ?exists ?if_exists ?default(“”)
exists:由空值测试运算符的引入,它被废弃了. exp1?exists 和 exp1??是一样的, ( exp1)?exists 和(exp1)??也是一样的. if_exists:由默认值运算符 ...
- p2 休眠模式
如有错误,忘请指出. 才入手p2.p2有全局休眠模式,和钢体体眠模式.钢体能控制 body.allowSleep world.NO_SLEEPING 不允许休眠world.BODY_SLEEPING ...
- 【前端学习笔记】JavaScript 小案例合集
获取一个0-9的随机数: Math.round(Math.random()*9); 去除数组中重复的元素: var arr=[1,3,5,4,3,3,1,4] function editArr(arr ...
- BZOJ 2424 订货(贪心+单调队列)
怎么题解都是用费用流做的啊...用单调队列多优美啊. 题意:某公司估计市场在第i个月对某产品的需求量为Ui,已知在第i月该产品的订货单价为di,上个月月底未销完的单位产品要付存贮费用m,假定第一月月初 ...