现在的位置: 首页 > 综合 > 正文

Windows下Discuz X2 版本的IIS静态化

2013年05月10日 ⁄ 综合 ⁄ 共 1316字 ⁄ 字号 评论关闭

      安装好Discuz X2论坛后进入后台的全局进行SEO设置后,正赞叹和陶醉在其功能的强大,接下来进入前台点击版块浏览时页面404错误,静态化不成功!仔细阅读其X1.5的安装手册说明:“检查 Discuz! X1.5 版本所在目录中是否存在 .htaccess 文件,如果不存在,请手工建立此文件。Win32 系统下,无法直接建立 .htaccess 文件,您可以从其他系统中拷贝一份,编辑并修改 .htaccess 文件,添加上面自动生成的 Apache Web Server(虚拟主机用户)Rewrite
规则代码。添加内容时,请遵照上面的提示,修改 Discuz! X1.5 版本所在的路径,然后保存。将 .htaccess 文件上传到 Discuz! X1.5 版本所在的目录中。”这是手册中的原文。内容说的也不明确,容易让新手产生误解,误将.htaccess文件上传到Windows操作系统中。其实.htaccess是Linux、Unix下的文件,而且也是针对Apache服务器而言的。Windows下使用httpd.ini文件,同时服务器为IIS虚拟主机,其格式如下

[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4
RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5
RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5
RewriteRule ^(.*)/([a-z]+)-(.+)\.html(\?(.*))*$ $1/$2\.php\?rewrite=$3&$5

将上述代码拷贝到记事本下,另存为httpd.ini上传到论坛的根目录下即可。希望能给为新手带来帮助。

抱歉!评论已关闭.