I've checked what it's about, and regarding
It's becoming very important for SEO stuff — yes, but only if you use the same content on different domains or websites. Then adding a canonical tag on all pages that link back to the definitive page makes sense.
I suppose, it's not your case? Or at least, if you have miniBB-based forum,
it's already a definitive source and I doubt it's worth to duplicate a dynamic forum of a certain subject on multiple domains or websites
on your own. It could be worth critically though in a case
someone steals your forum contents on-the-go.
For the dumb search engines, some other tricks are available already.
First of all, in miniBB there's a built-in ROBOTS tag implementation, which tells a search engine what pages to index (all threads and forum sections) and what to skip (search/registration forms, profiles, topic listings etc.). That way duplicating these pages elsewhere makes no sense, because they are not supposed to be indexed.
Second, on a topic page, the definitive URL is checked each time when you visit it, and if it's not equal to the URL you've typed, you will be redirected to the proper definitive URL. This works for
mod_rewrite module updates,
.php query strings and so on. You just have no chance to visit an indefitinive URL for such important content as topic/threads.
Third, for miniBB-based forum, you have one and only definitive URL initially, which is set up in
$main_url of
setup_options.php. And if for example when you have all these URLs available:
* https://www.example.com/forum/
* https://www.example.com/forum
* https://example.com/forum/
* https://example.com/forum— it is not up putting the Canonical tag at all. You have to set up proper redirections in
.htaccess for example (having an Apache web-server), and redirect to the definitive URL from www to non-www version, or otherwise, from non-www to www. Also cover the ending backslash, redirecting from non-backslash version to backslash version — all this should be set up on the physical server or script handling and not with the Canonical meta-tag.
There's one small issue which couldn't be easily tracked on the server level, which is when you have both URLs available like this:
*
https://www.example.com/forums/index.phpand
*
https://www.example.com/forums/— i.e. the forums could be opened both via
index.php and without it. Then putting the code below in
setup_options.php — above the very ending ?> tag — could help to solve this:
/* Handling index.php properly for definite URLs ending with a backslash */
$requrl=strtolower($_SERVER['REQUEST_URI']);
if(isset($_SERVER['SERVER_PROTOCOL']) and ($_SERVER['SERVER_PROTOCOL']=='HTTP/1.0' or $_SERVER['SERVER_PROTOCOL']=='HTTP/1.1') ) $proto=$_SERVER['SERVER_PROTOCOL']; else $proto='HTTP/1.1';
if(!isset($rheader)) $rheader='Location:';
if(substr_count($requrl, 'index.php')>0 and sizeof($_GET)==0 and sizeof($_POST)==0){
header($proto.' 301 Moved Permanently');
header($rheader.$main_url.'/');
exit;
}
Note:
this is only for the case when your definite forum URL ends with a slash and it shouldn't be opened via
index.php.
The Canonical meta tags implementation was actually in my ToDo list for the next miniBB releases, but I may think to implement them straight in the next miniBB update which is planned this summer.
It's not easy on the add-on level and also it should be optional, because as I know, many miniBB-based forum admins do not have Apache and run the forum without Keyword-rich URLs module, and there could be other circtumstances which do not require definite URLs at all, so — this is custom for each domain.
But like I mentioned all above, for a unique forum you probably have, the Canonical meta tag doesn't make sense if you handle all definite URLs with redirections, like described.