php伪静态规则iis
时间:
阅读:445
php伪静态规则iis
最佳回答
httpd.ini 编写格式:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
前四行是固定的,下面开始写规则
RewriteRule ^index.html$ index.php [I]
RewriteRule ^news-(.*).html$ news.php?id=$1 [I]
#注:(.*) 表示任意字符
RewriteRule ^news-(d+).html$ news.php?id=$1 [I]
#注:(d+) 表示只能数字
RewriteRule ^(.*)-(d+).html$ news.php?n=$1&id=2 [I]
#注:多参数,伪静态也可以自定义文件名字+ID号。更加有利于优化。
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
前四行是固定的,下面开始写规则
RewriteRule ^index.html$ index.php [I]
RewriteRule ^news-(.*).html$ news.php?id=$1 [I]
#注:(.*) 表示任意字符
RewriteRule ^news-(d+).html$ news.php?id=$1 [I]
#注:(d+) 表示只能数字
RewriteRule ^(.*)-(d+).html$ news.php?n=$1&id=2 [I]
#注:多参数,伪静态也可以自定义文件名字+ID号。更加有利于优化。
最新回答共有2条回答
-
游客
回复apache+php教程
伪静态写法与iis+php
伪静态区别
这是apache+php
伪静态配置方法
RewriteRule
/newhouse/m-(d+).html$
/newhouse/model.php?id=$1
RewriteRule
/newhouse/p2-(d+).html$
/newhouse/pic2.php?id=$1
iis+php
伪静态配置方法
RewriteRule
/newhouse/m-(d+).html
/newhouse/model.php?id=$1[N,I]
RewriteRule
/newhouse/p2-(d+).html
/newhouse/pic2.php?id=$1[N,I]
二者没有多大的区别,特别是在前段,后段把以前apache
.php?id=$1在iis改成了php?id=$1[N,I]写法。