Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

怎样在.htaccess里实现PHP的静态网页形式?

[复制链接]
dgdiscuz 发表于 2005-9-10 14:17:10 | 显示全部楼层 |阅读模式
这个应该是个新问题,不过对于Google的收录绝对有用!

我用的是discuz论坛,虚拟主机dg.homeweb.cn指向unix目录 /home/xxx/www/dg

我想在/home/xxx/www/dg下建立.htaccess文件,实现模拟静态网页,该怎么做?
我的.htaccess内容是这样的:

RewriteEngine on
RewriteBase /
RewriteRule ^(.*)/archiver/([a-z0-9\-]+\.html)$ $1/archiver/index.php?$2
RewriteRule ^(.*)/index.html$ $1/index.php?sid=$2
RewriteRule ^(.*)/digest.html$ $1/digest.php
RewriteRule ^(.*)/t-([0-9]+)\.html$ $1/viewthread.php?tid=$2
RewriteRule ^(.*)/f-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2
RewriteRule ^(.*)/t-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&page=$3&fpage=$4
RewriteRule ^(.*)/f-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)/f-([0-9]+)-([a-z0-9\-]+)\.html$ $1/forumdisplay.php?fid=$2&filter=$3
RewriteRule ^(.*)/p-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?fid=$2&tid=$3&action=printable


在IE里输入http://dg.homeweb.cn/digest.html 结果不行,在本地调试也不行。证明不成功,怎么办?
cqfanli 发表于 2005-9-17 11:47:42 | 显示全部楼层
你要打开rewrite,或者找开了.htaccess和rewrite 的虚拟主机~~
回复

使用道具 举报

 楼主| dgdiscuz 发表于 2005-10-29 13:50:38 | 显示全部楼层
我的主机就是开了rewrite的!
回复

使用道具 举报

yanyu 发表于 2005-10-31 11:08:44 | 显示全部楼层
我也有此一问
回复

使用道具 举报

lzhdm 发表于 2005-12-3 13:09:41 | 显示全部楼层
顶一下,希望有强人回答!
回复

使用道具 举报

mlmh 发表于 2005-12-3 23:50:23 | 显示全部楼层
目录要设置AllowOverride
去apache看文档
回复

使用道具 举报

cqfanli 发表于 2005-12-12 08:10:07 | 显示全部楼层
AllowOverride ALL
这样子肯定可以
回复

使用道具 举报

reishi 发表于 2006-2-18 19:56:52 | 显示全部楼层
顶个老贴,
好像你写的格式有错误吧!
是不是应该这样写啊?
RewriteRule ^(.*)/f-([0-9]+)\.html$ /forumdisplay.php?fid=$1
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-2-25 10:48 , Processed in 0.024492 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表