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

热点内容
支持dsd硬解压声卡 浏览:768
怎么查看u盘加密区 浏览:181
台电加密是什么格式 浏览:155
php论坛版块在哪个文件夹 浏览:442
暗黑的服务器为什么维护 浏览:624
android内存溢出的原因 浏览:18
标志307的压缩比是多少 浏览:636
服务器启动为什么叫三声 浏览:997
追风筝的人英文pdf 浏览:940
解压小熊手机壳 浏览:346
成都市区建成面积算法 浏览:661
智能家居单片机 浏览:97
买男装用什么app好 浏览:855
文件夹合并了怎么拆开 浏览:260
波段副图源码无未来函数 浏览:89
livecn服务器地址 浏览:259
程序员这个工作真的很吃香吗 浏览:847
程序员和数学分析师待遇 浏览:681
压缩气弹簧怎么拆 浏览:326
华为公有云服务器添加虚拟ip 浏览:211