Home  >  Article  >  Backend Development  >  Bo-Blog专用的给Windows服务器的IIS Rewrite程序_php实例

Bo-Blog专用的给Windows服务器的IIS Rewrite程序_php实例

WBOY
WBOYOriginal
2016-06-07 17:26:44790browse

本文将提供一个Bo-Blog用户在Windows的IIS 5.1/6.0服务器上实现URL Rewrite的方案。这个方案的优点是无需任何组件支持,不需要安装ISAPI筛选器(网上有不少,但最好用的却不是免费的);缺点是与通过ISAPI筛选器实现rewrite一样,最开始也需要IIS管理员的帮助。

实现方式如下:

A 下载附件,用文本编辑器打开其中的 iisrewrite.php 文件,将开头处的:
$blogdir='blog/';
修改为bo-blog的安装目录。比如
$blogdir='weblog/';
(如果安装在根目录下,写成 $blogdir=''; 否则需如上例一样,在路径结束处添加斜杠)
然后将这个文件上传到网站的 wwwroot 下。

注意:这个文件中包含的rewrite规则是适合 2.1.0 beta以上版本的,2.0.3 sp1不适用。

B 运行IIS Admin,如图,对需要rewrite的网站做相应设置。在自定义错误选单中,找到“404”错误的选项,编辑其属性,设置消息类型为:URL(重要,必须设置为URL,否则将导致服务器对不存在的页面给出404响应,而设置为URL后,rewrite后的页面的HTTP响应为正常的200)。地址设置为 /iisrewrite.php。
Bo-Blog专用的给Windows服务器的IIS Rewrite程序_php实例

C 到blog后台设置URL优化方式为“Apache URL Rewrite”。至此您已经可以像Apache用户一样使用程序的url rewrite功能了。

当前,本站的临时blog就做了这样的设置。
本地下载

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn