.php页面伪静态问题求助
我的网站原来是静态页面.html和.htm,现在因为需要增加一些功能改为.php页面了,但是有N多外链都是链接到以前的静态页面的,所以想做伪静态。[color=Red]注意:我的是IIS服务器[/color]
我的网站结构
旧的网站结构:
[url]http://www.xxx.com/index.htm[/url] 或 index.html
[url]http://www.xxx.com/123/index.htm[/url] 或 index.html
[url]http://www.xxx.com/123/abc.htm[/url] 或 index.html
新的网站结构:
[url]http://www.xxx.com/index.php[/url]
[url]http://www.xxx.com/123/index.php[/url]
[url]http://www.xxx.com/123/abc.php[/url]
[[i] 本帖最后由 蜗牛2008 于 2008-5-13 09:07 编辑 [/i]] 不会,楼下的回答 根目录建立.htaccess文件
代码大体如下,需要自己修改成想要的格式
# 打开 RewriteEngine 模式
RewriteEngine On
# 修改以下语句中的 /pbdigg2 为你的安装目录地址,如果程序放在根目录中,请将 /pbdigg2 修改为 /
RewriteBase /pbdigg2
# Rewrite 系统规则 PBDIGG 2.0
RewriteRule ^(index-)?([0-9]+)(\.html)?$ index.php?page=$2
RewriteRule ^category(\/|-)([0-9]+)-([0-9]+)(\.html)?$ category.php?cid=$2&page=$3
RewriteRule ^user(\/|-)([0-9]+)-([0-9]+)(\.html)?$ user.php?uid=$2&page=$3
RewriteRule ^show(\/|-)([0-9]+)-([0-9]+)(\.html)?$ show.php?tid=$2&page=$3 [quote]原帖由 [i]happygod[/i] 于 2008-5-13 09:02 发表 [url=http://www.im286.com/redirect.php?goto=findpost&pid=26132227&ptid=2578580][img]http://www.im286.com/images/common/back.gif[/img][/url]
根目录建立.htaccess文件
代码大体如下,需要自己修改成想要的格式
# 打开 RewriteEngine 模式
RewriteEngine On
# 修改以下语句中的 /pbdigg2 为你的安装目录地址,如果程序放在根目录中,请将 /pbdigg2 修改 ... [/quote]
你的不行啊 楼主咨询空间或者服务器提供商,请他们帮助提供文件 IIS服务器
需要修改apache的httpd.conf设置文档
如果打开了rewrite.so
在vhost段增加
RewriteEngine On
# 修改以下语句中的 /pbdigg2 为你的安装目录地址,如果程序放在根目录中,请将 /pbdigg2 修改为 /
RewriteBase /pbdigg2
# Rewrite 系统规则 PBDIGG 2.0
RewriteRule ^(index-)?([0-9]+)(\.html)?$ index.php?page=$2
RewriteRule ^category(\/|-)([0-9]+)-([0-9]+)(\.html)?$ category.php?cid=$2&page=$3
RewriteRule ^user(\/|-)([0-9]+)-([0-9]+)(\.html)?$ user.php?uid=$2&page=$3
RewriteRule ^show(\/|-)([0-9]+)-([0-9]+)(\.html)?$ show.php?tid=$2&page=$3 一 打开 Apache 的配置文件 httpd.conf 。
二 将#LoadModule rewrite_module modules/mod_rewrite前面的#去掉
三 在 httpd.conf中添加:
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{ENV:SCRIPT_URL} (?:index|dispbbs)[-0-9]+\.html
RewriteRule ^(.*?(?:index|dispbbs))-([-0-9]+)\.html 1.php?__is_apache_rewrite=1&__rewrite_arg=2
</IfModule>
四 要实现asp帖子URL到php帖子的映射,在 第三步的<IfModule mod_rewrite.c>和</IfModule>之间添加:
RewriteMap tolowercase int:tolower
RewriteCond %{QUERY_STRING} (?:boardid|page|id|replyid|star|skin)\=\d+ [NC]
RewriteRule ^(.*(?:index|dispbbs))\.asp 1.php?{tolowercase:%{QUERY_STRING}}&__is_apache_rewrite=1
五 保存httpd.conf并重启Apache。 这个问题 技术很难 不会 IIS下关键看支持不支持静态
页:
[1]

