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

热点内容
unity3d手机游戏开发pdf 浏览:366
mysql重启命令linux 浏览:876
程序员日常业余内容 浏览:363
steam如何更改吃鸡服务器 浏览:212
我的世界up主多人用什么服务器 浏览:161
缝纫机电脑机编程 浏览:59
autowired源码深度解析 浏览:895
校园卡怎么上app 浏览:743
pascal高精度算法 浏览:870
阿里云服务器如何修改php 浏览:8
51单片机小项目 浏览:607
为什么d盘e盘无法解压 浏览:314
软件放文件夹压缩以后会变小吗 浏览:669
文件夹中的图片怎么整体压缩 浏览:579
程序员那么可爱妈妈是谁演的 浏览:799
密码反编译在线 浏览:4
php学习小结 浏览:13
2019考研英语红宝书pdf 浏览:395
宋代科举pdf 浏览:24
android读取res 浏览:139