找回密码
 注册
搜索
热搜: 届技能大赛
查看: 3104|回复: 0

discuz7 静态化网页生成

[复制链接]
发表于 2009-8-1 11:10:53 | 显示全部楼层 |阅读模式
1配置Apache服务器支持.htaccess       这是独立主机配置(不需要在论坛目录下放置.htaccess文件),虚拟机让空间商配置。
1、让Apache支持mod_rewrite重写,打开Apache配置文件httpd.conf,查找并去掉下行前面的#号
   LoadModule rewrite_module modules/mod_rewrite.so
如果不加载以下代码,则需要把.htaccess文件放置到论坛目录
<IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteRule ^(.*)/archiver/((fid|tid)-[0-9]+\.html)$ $1/archiver/index.php?$2
                RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
                RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
                RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
                RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2
        </IfModule>
2、让Apache支持.htaccess,打开Apache虚拟主机配置文件/conf/extra/httpd-vhosts.conf,查找并更改配置如下:
    <Directory "E:/www/Souxiu">
    Options FollowSymLinks IncludesNOEXEC
    DirectoryIndex default.html default.php
    AllowOverride All //默认为None
    Order Deny,Allow
    Allow from all
    </Directory>
    AddDefaultCharset off //解决Apache中文乱码,关闭服务器的默认语言的发送,凭html文件头中设置的语言来决定网页语言。
注以下是:首页静态化规则
RewriteRule ^(.*)/index\.html$ $1/index.php
RewriteRule ^(.*)/index-([0-9]+)\.html$ $1/index.php?gid=$2
以上两行代码,加载后,网站index.html不能打开.修改网站首页文件名为default.html,并修改apache配置文件httpd.conf中的directoryIndex  index.html  index.php 为    directoryIndex  index.html  index.php default.html。重启apache 即可。
2、虚拟主机则把下面代码另存为.htaccess
# 将 RewriteEngine 模式打开
RewriteEngine On

RewriteBase /bbs

# Rewrite 系统规则请勿修改
RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1
RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2
RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2
RewriteRule ^tag-(.+)\.html$ tag.php?name=$1
注意:修改RewriteBase /bbs为你的论坛目录

3、上传附件到论坛目录

网站首页index.html与discuz论坛首页静态化后的index.html,有冲突。就是不能同时打开。修改网站首页后为default.html并修改apache配置文件增加default.html的支持后,最终解决。现在可以访问网站首页www.xwzjw.cn/default.html和论坛首页www.xwzjw.cn/bbs/index.html

首页静态化FOR DISCUZ7.00.rar

12.81 KB, 下载次数: 2241

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

本版积分规则

修武县职业技术学校 ( 豫ICP备2022015720号-2| 豫公网安备 41082102410925号 )

地址:修武县宁城路西段(森林半岛东邻) | 招生电话:0391-7186556

北京时间 Processed in 0.091320 second(s), 20 queries .

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