导航:首页 > 编程语言 > 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伪静态配置相关的资料

热点内容
通达信主力拉升出货指标公式源码 浏览:635
廉洁pdf 浏览:16
批量用修改多个文件夹及子目录 浏览:315
王者每个服务器爆满怎么办 浏览:947
安卓手机如何清除所有的数据 浏览:978
激光打标机加密狗驱动无法启动 浏览:908
硅谷程序员题库 浏览:558
安卓系统怎么开车模式 浏览:940
网剧程序员那么可爱15集完整版 浏览:172
pdf怎么生成 浏览:934
pythondict树 浏览:582
ilo2命令 浏览:292
会饮pdf 浏览:88
软件加密到哪里去了 浏览:604
nas可以做云服务器吗 浏览:623
app利率怎么算 浏览:8
广电运通程序员 浏览:568
程序员放弃后会怎样 浏览:189
河北模具编程 浏览:192
adb查找命令 浏览:325