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 :

<link rel="canonical" href="" />

In the forum pages :

<link rel="canonical" href="" />

In the topic pages :

<link rel="canonical" href="" />

For global threads* :

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

Download modification :


Note :

Normally, global threads will have canonical URLs like this :

<link rel="canonical" href="" />

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 :

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

In-line Find :

? ''

Replace with :

? "f=Y&amp;"

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


  1. Karate_BKC says:

    Dear sir,
    I would like to try to download your conical url module. expected, this module can work fine at our site forum.
    Thanks sir,
    Karate BKC Indonesia

  2. Ellimist says:

    Your forum apparently runs on SMF. :)

  3. Emir says:


    Is it OK to use this mode in combination with a robots.txt (

    Best regards,

    1. Ellimist says:

      Yes, you can use both of them in tandem. But if you use canonical URL tags, you really need not use those robots.txt directives. It’s up to you.

      1. Emir says:

        Thank you.

  4. Hello,

    your theme at is “locked” for some reason.

    Are you still working on this mod? Can it be used with phpBB 3.0.7 PL1?


    1. Ellimist says:

      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. Ellimist says:

      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.

  5. Berk says:

    hi, Ellimist!

    link in browser

    link canonical

    if you insert canonical link in browser it not will be working

    its normally?

    thank you!

    1. Ellimist says:

      Yes, that is perfectly normal. When “&” is parsed by the browser, it turns to ‘&’ only.

  6. Berk says:

    after installing this mod, google stopped indexing my forum

    1. Ellimist says:

      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.

  7. Berk says:

    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. Ellimist says:

      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”.

  8. Berk says:

    you suggest to wait until Google will index all over again?

    1. Ellimist says:

      Yes. You can do that.

  9. joncooperst says:

    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 .