iis中ISAPI_Rewrite实现php伪静态

发布时间:2020-09-04编辑:脚本学堂
本文介绍在iis中通过ISAPI_Rewrite实现php伪静态的方法,感兴趣的朋友参考下。

有些windows主机中,iis不支持.htaccess 文件,如果是本地机器,apmserv服务器可以用.htaccess 文件,用apmserv服务器环境配置伪静态,请参考文章:php伪静态配置之url rewrite实例教程

这里主要介绍下httpd.ini配置php伪静态的方法。

例如,www.jb200.com/index.php
可以用www.jb200.com/index.html 来直接访问。
www.jb200.com/newxx.php?=10 [newxx.php 是新闻的详细页面]
伪静态成为 www.jb200.com/new-10.html

实现过程,httpd.ini 源文件:
 

复制代码 代码示例:
[ISAPI_Rewrite]
# 3600 = 1 hour
# CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^/httpd(?:.ini|.parse.errors).* [F,I,O]
RewriteRule /index.html /index.php
RewriteRule /new-([0-9]+).html$ /newxx.php?uid=$1 以上例子可以看出 RewriteRule /index.html /index.php 是把index.php 转换为 index.html
RewriteRule /new-([0-9]+).html$ /newxx.php?uid=$1 转换为 new-10{这个10为id=几的值}.html

以上介绍了iis中在http.ini中配置php伪静态的方法,希望对大家有所帮助。