English
 电子信箱
 加入收藏

  威盾防火墙 >> 新闻中心 >> 威盾新闻 >> php 伪静态之IIS篇

 

php 伪静态之IIS篇

威盾防火墙 2015-01-22

 
上篇文章我们讲解了APACHE服务器下伪静态的实现,不过在国内还是IIS的服务器要多些,特别是个人站长,那么,我们再来学习下IIS下php伪静态的实现过程吧

有的win主机IIS不支持 .htaccess 文件, 我在这里指的不是本地 在本地的话用apmserv服务器可以用.htaccess 文件,用apmserv服务器环境配置伪静态可以看 php 伪静态 (url rewrite mod_rewrite 重写) 这篇文章,讲的很详细.

这里我们主要讲解httpd.ini 废话不说直接看效果~

例: www.jb51.net/index.php
我们想让他用 www.jb51.net/index.html 来直接访问
www.jb51.net/newxx.php?=10 [newxx.php 是新闻的详细页面]
我们把他伪静态成为 www.jb51.net/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

很简单吧。 这种伪静态一般 win主机的空间商基本都支持的!


相关内容: 最新内容:
ISAPI Rewrite多站点破解版 完美实现IIS伪静态的方法[2015-01-22]
apache伪静态与iis伪静态规则与配置区别介绍[2015-01-22]
IIS防盗链 ISAPI Rewrite图片防盗链规则写法[2015-01-22]
Apache下MP3 防盗链的解决办法[2015-01-22]
Apache 防盗链的技术小结[2015-01-22]
设置cookie的时候方式XSS攻击[2015-01-22]