导航:首页 > 编程语言 > phpiis6伪静态配置

phpiis6伪静态配置

发布时间:2025-03-09 15:51:20

‘壹’ 求助php伪静态,如何将动态PHP页面改为伪静态页面

伪静态实际上就是把 index.php?act=about&cid=1 将这种形式的动态路径用 about-1.html 这种形式输出,也就是说浏览器每次访问about-1.html地址能打开相应的index.php?act=about&cid=1动态网址。

伪静态的实现本质上是配置服务器进行路径转换,根据不同的服务器环境,配置方法也不太一样,PHP+iis6的话就要配置httpd.ini文件,php+iis7就要配置web.config,PHP+apache就要配置.htaccess文件(或者httpd.conf)

.htaccess(或者httpd.conf)文件的规则示例:
RewriteEngine on
RewriteRule ^/?(index|guestbook|online)\.html$ index\.php [L]
RewriteRule ^/?(eindex)\.html$ index\.php?act=$1 [L]
RewriteRule ^/?(index|guestbook|online)-([0-9]+).html$ index\.php\?p=$2 [L]
RewriteRule ^/?([a-z0-9]+)_([0-9]+).html$ index\.php\?act=$1&id=$2 [L]
RewriteRule ^/?([a-z0-9]+)-([0-9]+).html$ index\.php\?act=$1&cid=$2 [L]
RewriteRule ^/?([a-z0-9]+)-([0-9]+)-([0-9]+).html$ index\.php\?act=$1&cid=$2&p=$3 [L]

httpd.ini示例:
[ISAPI_Rewrite]
RepeatLimit 32
# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]
RewriteRule ^/(index|guestbook|online)\.html$ /$1\.php
RewriteRule ^/(eindex).html$ /index\.php\?act=$1
RewriteRule ^/(index|guestbook|online)-([0-9]+).html$ /$1\.php\?p=$2
RewriteRule ^/([a-z0-9]+)_([0-9]+).html$ /index\.php\?act=$1&id=$2
RewriteRule ^/([a-z0-9]+)-([0-9]+).html$ /index\.php\?act=$1&cid=$2
RewriteRule ^/([a-z0-9]+)-([0-9]+)-([0-9]+).html$ /index\.php\?act=$1&cid=$2&p=$3

阅读全文

与phpiis6伪静态配置相关的资料

热点内容
上海php兼职 浏览:715
顺丰app如何验证学生 浏览:367
服务器mac地址过滤器 浏览:928
程序员一年内被开除 浏览:452
福建文档课件加密企业 浏览:776
appstore美国的界面怎么看呀 浏览:520
hlt单片机 浏览:311
CA的命令 浏览:680
安卓怎么传王者应用给苹果 浏览:909
aws云服务器自建 浏览:827
如何更换服务器登录网站 浏览:688
java修改ip地址 浏览:825
java操作cookie 浏览:683
ping命令2个ip 浏览:220
怎么御载软件商店加密应用 浏览:804
小周服务器为什么进不去 浏览:300
游戏制作用什么编译语言 浏览:641
矢量图怎么加密码 浏览:668
知到app怎么刷课时 浏览:600
三程序员那么可爱 浏览:956