欢迎光临
我们一直在努力

Discuz! X3.4主题分类和分类信息伪静态设置方法(修改文件实现非插件)

建站超值云服务器,限时71元/月
  1. if(in_array('forum_forumdisplay', $_G['setting']['rewritestatus'])) {
                            $data['search']['forum_forumdisplay'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=forumdisplay&(amp;)?fid\=(\w+)(&page\=(\d+))?\"([^\>]*)\>/";
                            $data['replace']['forum_forumdisplay'] = 'rewriteoutput(\'forum_forumdisplay\', 0, $matches[1], $matches[3], $matches[5], $matches[6])';
                    }
    
    

,

  1.         if(in_array('forum_forumdisplay_type', $_G['setting']['rewritestatus'])) {
                $data['search']['forum_forumdisplay_type'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=forumdisplay&(amp;)?fid\=(\w+)(&typeid\=(\w+))?(&filter\=typeid)?(&typeid\=(\w+))?(&filter\=typeid)?(&page\=(\d+))?\"([^\>]*)\>/e";
                $data['replace']['forum_forumdisplay_type'] = "rewriteoutput('forum_forumdisplay_type', 0, $matches[1], $matches[3], $matches[8], $matches[11], $matches[12])";
            }

复制代码,

  1. $data['rulesearch']['forum_forumdisplay'] = 'forum-{fid}-{page}.html';
                    $data['rulereplace']['forum_forumdisplay'] = 'forum.php?mod=forumdisplay&fid={fid}&page={page}';
                    $data['rulevars']['forum_forumdisplay']['{fid}'] = '(\w+)';
                    $data['rulevars']['forum_forumdisplay']['{page}'] = '([0-9]+)';

复制代码,

  1.         $data['rulesearch']['forum_forumdisplay_type'] = 'forum-{fid}-{typeid}-{page}.html';
            $data['rulereplace']['forum_forumdisplay_type'] = 'forum.php?mod=forumdisplay&fid={fid}&filter=typeid&typeid={typeid}&page={page}';
            $data['rulevars']['forum_forumdisplay_type']['{fid}'] = '(\w+)';
            $data['rulevars']['forum_forumdisplay_type']['{typeid}'] = '(\w+)';
            $data['rulevars']['forum_forumdisplay_type']['{page}'] = '([0-9]+)';
    
    

,

  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 ? $page : 1,
                    );

复制代码,

  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 ? $page : 1,
            );
        } elseif($type == 'forum_forumdisplay_type') {
            list(,,, $fid, $typeid, $page, $extra) = func_get_args();
            $r = array(
            '{fid}' => empty($_G['setting']['forumkeys'][$fid]) ? $fid : $_G['setting']['forumkeys'][$fid],
            '{typeid}' => $typeid,
            '{page}' => $page ? $page : 1,
            );
    
    

,

  1. RewriteCond %{QUERY_STRING} ^(.*)$
  2. RewriteRule ^forum-(\w+)-(\w+)-([0-9]+)\.html[        DISCUZ_CODE_160        ]nbsp;forum.php?mod=forumdisplay&fid=$1&filter=typeid&typeid=$2&page=$3&%1

,实现方法:

编辑:

\source\function\function_admincp.php

查找:(约1250~1253行)

  1. if(in_array('forum_forumdisplay', $_G['setting']['rewritestatus'])) {
                            $data['search']['forum_forumdisplay'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=forumdisplay&(amp;)?fid\=(\w+)(&page\=(\d+))?\"([^\>]*)\>/";
                            $data['replace']['forum_forumdisplay'] = 'rewriteoutput(\'forum_forumdisplay\', 0, $matches[1], $matches[3], $matches[5], $matches[6])';
                    }
    
    

在其下行添加:

  1.         if(in_array('forum_forumdisplay_type', $_G['setting']['rewritestatus'])) {
                $data['search']['forum_forumdisplay_type'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=forumdisplay&(amp;)?fid\=(\w+)(&typeid\=(\w+))?(&filter\=typeid)?(&typeid\=(\w+))?(&filter\=typeid)?(&page\=(\d+))?\"([^\>]*)\>/e";
                $data['replace']['forum_forumdisplay_type'] = "rewriteoutput('forum_forumdisplay_type', 0, $matches[1], $matches[3], $matches[8], $matches[11], $matches[12])";
            }

复制代码

查找:(约1299~1302行)

  1. $data['rulesearch']['forum_forumdisplay'] = 'forum-{fid}-{page}.html';
                    $data['rulereplace']['forum_forumdisplay'] = 'forum.php?mod=forumdisplay&fid={fid}&page={page}';
                    $data['rulevars']['forum_forumdisplay']['{fid}'] = '(\w+)';
                    $data['rulevars']['forum_forumdisplay']['{page}'] = '([0-9]+)';

复制代码

在其下行添加:

  1.         $data['rulesearch']['forum_forumdisplay_type'] = 'forum-{fid}-{typeid}-{page}.html';
            $data['rulereplace']['forum_forumdisplay_type'] = 'forum.php?mod=forumdisplay&fid={fid}&filter=typeid&typeid={typeid}&page={page}';
            $data['rulevars']['forum_forumdisplay_type']['{fid}'] = '(\w+)';
            $data['rulevars']['forum_forumdisplay_type']['{typeid}'] = '(\w+)';
            $data['rulevars']['forum_forumdisplay_type']['{page}'] = '([0-9]+)';
    
    

编辑:

\source\function\function_core.php

查找:(约940~945行)

  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 ? $page : 1,
                    );

复制代码

在其下行添加:

  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 ? $page : 1,
            );
        } elseif($type == 'forum_forumdisplay_type') {
            list(,,, $fid, $typeid, $page, $extra) = func_get_args();
            $r = array(
            '{fid}' => empty($_G['setting']['forumkeys'][$fid]) ? $fid : $_G['setting']['forumkeys'][$fid],
            '{typeid}' => $typeid,
            '{page}' => $page ? $page : 1,
            );
    
    

编辑:

/source/language/lang_admincp.php

查找:(约1509行)

‘setting_seo_rewritestatus_forum_forumdisplay’ => ‘论坛主题列表页’,

复制代码

在其下行添加:

‘setting_seo_rewritestatus_forum_forumdisplay_type’ => ‘论坛主题分类页’,

勾选提交之后,点击右上角“查看当前的 Rewrite 规则”

在你的伪静态规则添加你对应主机类型的相关伪静态规则,

举个例子,比如

Apache Web Server(虚拟主机用户)环境:

.htaccess 添加如下规则,即可生效。

伪静态规则:

  1. RewriteCond %{QUERY_STRING} ^(.*)$
  2. RewriteRule ^forum-(\w+)-(\w+)-([0-9]+)\.html[        DISCUZ_CODE_160        ]nbsp;forum.php?mod=forumdisplay&fid=$1&filter=typeid&typeid=$2&page=$3&%1


赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Discuz! X3.4主题分类和分类信息伪静态设置方法(修改文件实现非插件)
分享到: 更多 (0)