From da7f88f6443067acfcd176343b06c891fe51d1a3 Mon Sep 17 00:00:00 2001 From: Jimmi08 Date: Thu, 31 Mar 2022 12:42:35 +0200 Subject: [PATCH] #4712 canonical URLs for paged forum topic CLOSES #4712 --- e107_plugins/forum/e_url.php | 7 +++++++ e107_plugins/forum/forum_viewtopic.php | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/e107_plugins/forum/e_url.php b/e107_plugins/forum/e_url.php index f684e7f11..cfaee9bfb 100644 --- a/e107_plugins/forum/e_url.php +++ b/e107_plugins/forum/e_url.php @@ -86,6 +86,13 @@ class forum_url // plugin-folder + '_url' 'sef' => 'forum/{forum_sef}/{thread_id}/{thread_sef}/', 'redirect' => '{e_PLUGIN}forum/forum_viewtopic.php?id=$2&$4' ); + + $config['topic-canonical'] = array( + 'regex' => 'forum\/([^\/]*)\/([\d]*)(?:\/|-)([\w-]*)/?\??(.*)', + // 'regex' => '^forum/(.*)/(\d*)(?:-|/)([\w-]*)/?\??(.*)', + 'sef' => 'forum/{forum_sef}/{thread_id}/?p={thread_page}', + 'redirect' => '{e_PLUGIN}forum/forum_viewtopic.php?id=$2&$4' + ); /* $config['subforum'] = array( 'regex' => '^forum/(.*)/(.*)$', diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index e2994d468..739070b67 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -376,8 +376,10 @@ else e107::getDebug()->log($ret); unset($ret); } + +$thread->threadInfo['thread_page'] = varset($thread->page,1); +e107::canonical('forum', 'topic-canonical', $thread->threadInfo); -e107::canonical('forum', 'topic', $thread->threadInfo); require_once (HEADERF);