导航:首页 > 编程语言 > php路径转换

php路径转换

发布时间:2025-07-13 20:54:40

⑴ 求助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

⑵ php语言url路径中英文转换问题

加密 urlencode加密和urldecode解密处理

阅读全文

与php路径转换相关的资料

热点内容
安卓息屏是什么原因 浏览:260
补码位数进1怎么变回源码 浏览:287
linux如何安装中文 浏览:404
怎么中断服务器或共享的所有连接 浏览:152
最美c语言编译器 浏览:1000
安卓手机如何录像的时候放音乐 浏览:199
二手r720服务器怎么样 浏览:172
程序员那么可爱化妆是哪一集 浏览:481
还是一个程序员好 浏览:733
shell运行python程序 浏览:321
墨迹小视频缓存在哪个文件夹 浏览:248
我的世界丧尸大逃杀是什么服务器 浏览:404
博客虚拟资源网站源码 浏览:138
王羲之圣教序pdf 浏览:566
程序员要多久才能年薪50万 浏览:256
浪潮服务器怎么开机箱 浏览:92
我的世界服务器ice怎么设置密码 浏览:373
我的世界服务器怎么设置成op 浏览:228
服务器上的图片如何最小 浏览:247
python爬虫高级视频教程 浏览:800