论坛想要伪静态化,首先要确定您的虚拟空间支持伪静态(这个可以询问您的虚拟空间提供商,一般都支持的),如果支持按照以下操作便可实现Discuz! X2动力社区论坛伪静态化。
先看Discuz! X2对URL 伪静态化的解释:URL 静态化可以提高搜索引擎抓取,开启本功能需要对 Web 服务器增加相应的 Rewrite 支持,且会轻微增加服务器负担。同时你还可以调整每个页面的静态格式,但不得删除其中的标记,重置静态格式请留空。注意,修改静态格式后你需要修改服务器 的 Rewrite 规则设置。
第一步:Discuz!论坛后台设置
在Discuz!论坛管理后台处进行seo设置提交,如图:
(Discuz!论坛后台设置)
第二步:上传规则
需要在虚拟空间根目录下上传ISAPI_Rewrite.dll(直接下载ISAPI_Rewrite.dll并上传便可)和伪静态化规则httpd.ini(在论坛后台设置里面有规则,见上图的右上角)
以上两步,轻松搞定Discuz! X2论坛伪静态化。
附:虚拟空间实现Discuz! X2论坛伪静态化httpd.ini规则如下(新建一个文本文件,把以下代码复制进去,重命名为:httpd.ini 便可)
[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 ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5
RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?action=$2&value=$3&$5
本文地址:http://www.seozz.net/zzseo/Discuzwjt_7426.html
本文标题:Discuz! X2动力社区论坛虚拟空间伪静态化方法