注册 | 登录 |
地方论坛门户及新闻和人才网址大全

discuz x3.2板块和帖子目录化伪静态

时间:2021-07-21人气:-


据说网站权重是:二级域名>目录>静态页>动态页。打开sourcefunction下的function_core.php 查找
if($type == 'forum_forumdisplay') {       list(,,, $fid, $page, $extra) = func_get_args();       $r = array(               '{fid}' => empty($_G['setting']['forumkeys'][$fid]) ? $fid : $_G['setting']['forumkeys'][$fid],               '{page}' => $page ? $page : 1,           );       } elseif($type == 'forum_viewthread') {           list(,,, $tid, $page, $prevpage, $extra) = func_get_args();           $r = array(               '{tid}' => $tid,               '{page}' => $page ? $page : 1,               '{prevpage}' => $prevpage && !IS_ROBOT ? $prevpage : 1,       );
将上述代码修改为:
if($type == 'forum_forumdisplay') {            list(,,, $fid, $page, $extra) = func_get_args();            $r = array(                '{fid}' => empty($_G['setting']['forumkeys'][$fid]) ? $fid : $_G['setting']['forumkeys'][$fid],                '{page}' => $page ,            );        } elseif($type == 'forum_viewthread') {            list(,,, $tid, $page, $prevpage, $extra) = func_get_args();            $fid = DB::result_first("SELECT fid FROM ".DB::table('forum_thread')." WHERE tid = '$tid'");            $r = array(                '{fid}' => empty($_G['setting']['forumkeys'][$fid]) ? $fid : $_G['setting']['forumkeys'][$fid],                '{tid}' => $tid,                '{page}' => $page ,                '{prevpage}' => $prevpage && !IS_ROBOT ? $prevpage : 1,        );
网站后台->全局->”seo设置”->”url静态化”在”论坛主题列表页”的格式中填写:{fid}/{page}在”论坛主题内容页”的格式中填写:{fid}/m{tid}/{page}在伪静态规则(.htaccess文件,一般在根目录下),记事本打开,在最后添加如下规则:## 保留前面的部分可以不影响已经被搜索引擎收录的页面
RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule /m([0-9]+)(/([0-9]+))?(/)?$ forum.php?mod=viewthread&tid=$1&extra=page%3D$5&page=$3&%1 [L,NC]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^([0-9a-z_]+)(/([0-9]+))?(/)?$ forum.php?mod=forumdisplay&fid=$1&page=$3&%1 [L,NC]


上篇:discuz X3.4分区伪静态方法

下篇:让Discuz! X3.2 SEO标题里的“-”支持空格