Discuz! X3.2 主题分类伪静态化如图:
效果如:https://www.ys166.com/chediy-191-type-5818-1.html
修改方法:
1,在/source/function/function_admincp.php找
- if(in_array('forum_forumdisplay', $_G['setting']['rewritestatus'])) {
- $data['search']['forum_forumdisplay'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=forumdisplay&(amp;)?fid\=(\w+)(&page\=(\d+))?"([^\>]*)\>/e";
- $data['replace']['forum_forumdisplay'] = "rewriteoutput('forum_forumdisplay', 0, '\\1', '\\3', '\\5', '\\6')";
- }
复制代码
在下面添加:
- 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, '\\1', '\\3', '\\8', '\\11', '\\12')";
- }
复制代码
再找到
- $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]+)';
复制代码
在下面添加:
- $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]+)';
复制代码
2、在/source/function/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,
- );
- }
复制代码
在下面添加如:
- 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,
- );
- }
复制代码
3、在/source/language/lang_admincp.php里找到
- 'setting_seo_rewritestatus_forum_forumdisplay' => '论坛主题列表页',
复制代码
在下面添加如:
- 'setting_seo_rewritestatus_forum_forumdisplay_type' => '论坛主题分类页',
复制代码
下面是主题贴子静态化方法:
4,在/source/function/function_admincp.php找
- if(in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
- $data['search']['forum_viewthread'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=viewthread&(amp;)?tid\=(\d+)(&extra\=(page\%3D(\d+))?(%26filter%3Dtypeid%26typeid%3D(\d+))?)?(&page\=(\d+))?"([^\>]*)\>/e";
- $data['replace']['forum_viewthread'] = "rewriteoutput('forum_viewthread', 0, '\\1', '\\3', '\\10', '\\6', '\\11')";
- }
复制代码
修改为:
- if(in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
- $data['search']['forum_viewthread'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=viewthread&(amp;)?tid\=(\d+)(&extra\=(page\%3D(\d+))?(%26filter%3Dtypeid%26typeid%3D(\d+))?)?(&page\=(\d+))?"([^\>]*)\>/e";
- $data['replace']['forum_viewthread'] = "rewriteoutput('forum_viewthread', 0, '\\1', '\\3', '\\10', '\\6', '\\11')";
- }
复制代码 |