导航:首页 > 编程语言 > iis75伪静态php

iis75伪静态php

发布时间:2023-12-27 16:20:25

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

Ⅱ IIS 服务器下的PHP伪静态要怎么弄啊

IIS配置支持伪静态 ISAPI Rewrite(win2003系统)

第一:首先我们需要下载一个ISAPI_Rewrite,有精简版和完全版,一般精简版只能对服务器全局进行配置,而完整版可以对服务器上的各个网站进行伪静态配置.对于个人站长来说,精简版就足够了.

下载:http://www.isapirewrite.com/download/isapi_rwl_0055.msi

第二:下载完成后,可以找到安装包里的.msi的文件,安装即可.

随便装在哪都可以,默认是装在C:\Program Files\Helicon下,要注意的是这个目录everyone要有读取权限。我就因为当时服务器权限配的比较严格,默认安装Helicon这目录EVERYONE是没有任何权限的,结果老是出现:Service Unavailable 。

第三:打开Internet 信息服务,右键,web站点属性,点击ISAPI筛选器选项卡.添加筛选器,这里的名称可以自己随意填写,路径自己指定ISAPI_Rewrite.dll,然后确定.

下面我们先做一个测试页new.asp,可以按照下面的代码写

然后,在浏览器中输入:

http://127.0.0.1/new.asp?id=1234

接着你就可以在网页上看到一行文字:"1234"

看到这几个数字,就说明你测试成功了.

现在我们开始来配置ISAPI_Rewrite :

打开ISAPI_Rewrite的目录,把httpd.ini的只读属性去掉,打开编辑.我们现在是需要把new.asp?id=1234修改成类似new_1234.html的路径,因此,我们需要在httpd.ini中添加一句

RewriteRule /new_([0-9,a-z]*).html /new.asp?id={GetProperty(Content)}

保存后,我们就可以测试一下这个网址了:http://127.0.0.1/new_1234.html

可以看到页面上的"1234"了吧,就这样伪静态配置成功了!

阅读全文

与iis75伪静态php相关的资料

热点内容
pythonsocket编程书籍 浏览:615
云眸用什么app 浏览:205
前端程序员留在北上还是二线 浏览:404
基于单片机的门禁控制系统 浏览:969
计算机怎么折叠文件夹 浏览:150
什么是服务器拆机卡 浏览:281
ad18编译pcb 浏览:346
开原研究生管理系统源码 浏览:170
pdf擦除工具 浏览:373
帝国首页模板下载哪个文件夹 浏览:855
有没有用云服务器赚钱的 浏览:93
rubypdf 浏览:471
文艺复兴史pdf 浏览:733
PDFgps测量 浏览:982
2k16生涯模式文件夹 浏览:395
研发云服务器续费 浏览:447
php地址重写 浏览:344
网上练瑜伽用什么app最好 浏览:557
文件夹为何搜索不了 浏览:338
怎么快捷删除lol换肤文件夹 浏览:253