Add canonical links to phpBB

phpbb-logo-greenIt’s old news that Google and other major search engines have added support for the <link rel="canonical"> tag to help cut down on duplicate indexing of web pages. While plugins for WordPress, Drupal and Magneto E-Commerce have been released, there has been none such modification for phpBB, where it is, arguably, most needed.

phpBB administrators have used various methods to cut down on this duplicate indexing issue, but adding a canonical URL seems to be the most subtly effective way. Google honours this tag very strongly, and upon finding it in a web page, it should only index the canonical page.

In the view of all this, I have put together a mod for phpBB3 to add the canonical links to phpBB board pages. The Canonical URL mod adds these lines to the phpBB pages :

In the index page :

[html]<link rel="canonical" href="" />[/html]

In the forum pages :

[html]<link rel="canonical" href="" />[/html]

In the topic pages :

[html]<link rel="canonical" href="" />[/html]

For global threads* :

[html]<link rel="canonical" href="" />[/html] support thread :

Download modification :


Note :

Normally, global threads will have canonical URLs like this :

[html]<link rel="canonical" href="" />[/html]

If you want the global threads to have canonical URLs with an “f=Y” query string, you just need to make a little change to the code. After installing the mod, open viewtopic.php.
Find :

[php] ‘U_CANONICAL’ => generate_board_url() . "/viewtopic.$phpEx?" . (($topic_data[‘topic_type’] == POST_GLOBAL) ? ” : "f=$forum_id&amp;") . "t=$topic_id" . (($start) ? "&amp;start=$start" : ”),[/php]

In-line Find :

[code]? ”[/code]

Replace with :

[php]? "f=Y&amp;"[/php]

Replace ‘Y’ with the forum id of the forum you want your global threads to belong to.

Join the Conversation


    1. I do not know why it was locked. I’ll PM a MOD team member to find out why.

      As for your query, this mod can be used without any problems with phpBB 3.0.7-PL1.

    2. It seems that they have set up a customisation database called Titania, and they have moved all the styles and mods to there. The mod and styles forum have been set to read-only.

      You can get support for this mod here. or by commenting on this post.

    1. Not if you install this mod correctly, no. You may see a temporary decrease in indexing activity, as it does not have to go through all those bogus/duplicate URLs. But it will not cause Google to stop indexing your board.

      Look at the boards that are using these mods :


      They are well indexed and crawled regularly by Google.

  1. 1. I installed this mod with “Prevent duplicate indexing of phpBB3 threads by Google”, that right?

    or “Add canonical links to phpBB” mod its enough?

    ” 1.

    On my board canonical links displayed as well as on those sites, but in google index has fallen almost to zero (before installing it 3500)

    1. It hasn’t fallen to zero.

      Look, previously, all the duplicate URLs were indexed by Google. So the number of pages indexed were wrongly inflated. Now that Google only indexes one URL for each post/forum, the number of URLs indexed by Google naturally will decrease. This is normal and will eventually lead to an increase in your search engine rank.

      I checked your site and it is in good standing with Google. Your homepage is crawled very frequently. It showed me, “Crawled 3 hours ago”.

  2. Je cherchais ce forum merveilleux, et il a trouvé . Maintenant, je suis votre nom d’utilisateur régulier.rnMerci pour l’administration de ce forum .

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.