Fork me on GitHub
Subscribe 4

Ticket #963 (fixed bug)

Add rel="prev", rel="next" and rel="canonical"

  • Created: 2014-04-13 12:18:25
  • Reported by: Michael
  • Assigned to: quy
  • Milestone: 1.5.8
  • Component: code
  • Priority: normal

If I add the address of the string after the slash, the content will be displayed in spite of everything.
This can lead to duplicate content in the search engines if competition would be to link the page.
Can you add a 301 redirect for bad links on the next milestone?



Franz 2014-04-14 09:37:05

  • Component changed from security to code.
  • Milestone set to 1.5.7.

Hmm, that's because of how we sanitize the ID parameters. Shouldn't this be a bad request instead?

Franz 2014-04-14 09:38:12

I don't think that the duplicate problem is really a problem, as there would need to be incorrect links somewhere in order for Google to index it.

I don't think somebody is going to run around posting links like that just to make Google think your site has duplicate content.

Michael 2014-04-14 14:20:04

Ya, but I (and maybe someone else) use mod rewtite on apache server(and FluxRewrite mod), and links look like this:

It has no parameters; you can add a string after the slash:

Comment edited 1 times (Diff)

Michael 2014-04-14 14:29:14

An alternative solution is add a link rel="canonical" to head section, if the redirect is impossible.

Franz 2014-04-14 21:11:28

Yea, that would be my preferred solution, but probably not before v2.0 (where we will have the pretty URLs in the core).

Are you being penalized by Google?

Michael 2014-04-15 13:44:28

I know the case where the duplicate was Indexed, but they used the urls without parameters.
Currently they use redirects. (I sent you a link to the forum on email).
I'm not sure the same will happen with the default parameters FluxBB, but I suspect that it matters-it is still the same parameter, but with a slash.

quy 2014-05-05 14:28:43

Per this article, it appears we should be using rel=”prev” and rel=”next” pagination markup which was dropped with this ticket #638. Reinstate? Would it solve this issue?

Michael 2014-05-05 15:43:30

I think that adding the rel="canonical" would be a good option.
As for pagination- I think you should move relations with a link to the head section-


quy 2014-05-05 20:00:24

  • Owner set to quy.


Submitted pull request.

quy 2014-05-06 00:22:18

I think that adding the rel="canonical" would be a good option.

What would the rel="canonical" be for pages after page 1?

quy 2014-05-06 12:02:42

From this page:

rel="next" and rel="previous" on the one hand and rel="canonical" on the other constitute independent concepts. Both declarations can be included in the same page. For example, … sionid=123 may contain:

<link rel="canonical" href="”/>
<link rel="prev" href="" />
<link rel="next" href="" />

My head is spinning 8). Which should we do???

Also, I assume no need to add rel="canonical", rel="prev", and rel="next" to viewforum.

Franz 2014-05-06 12:11:45

Only prev and next, no need for canonical as far as I see.

quy 2014-05-06 12:45:40

I am going to do it this way.

Add rel="canonical" if there is only 1 page.
Add rel="prev" and rel="next" if more than 1 page.


Michael 2014-05-06 12:49:33

Canonical next and prev are independent of each other relations- you should use it both:

Franz 2014-05-06 12:54:09

But you only need canonical to do something against duplicate content, which you don't have if there are multiple pages of one topic.

quy 2014-05-06 12:55:06

Michael, I am still unclear for the following:

Should rel="canonical", rel="prev", and rel="next" be applied to viewforum?

What should the rel="canonical" be for pages after page 1?

Michael 2014-05-06 13:15:44

Canonical should be on every page. Where there is pagination-next and prev. Also in viewforum.

It would be nice also add itemtype and itemprop (, but after migration to HTML5.

quy 2014-05-06 15:27:18

Commit ba9b06d to fluxbb master

#963: Add rel=“next” and rel=“prev”

quy 2014-05-06 18:03:24

The following links go to the same page: … 837#p54837

PunBB has this in viewtopic:

// Allow indexing if this is a permalink
if (!$pid)
        define('FORUM_ALLOW_INDEX', 1);

Do you see any cons in adding this to the core??


Is this where rel="canonical" comes into play?

Comment edited 1 times (Diff)

Franz 2014-05-06 20:44:57

Ah, right. That's where we need the canonicals...

Michael 2014-05-06 20:50:02

I too noticed it, but I didn't think that it contains a noindex. Right- this should be remove and replace the canonical.

If you would use both rel="nofollow" and rel="canonical" - the canonical page may be not indexed.

Comment edited 1 times (Diff)

Franz 2014-05-06 21:08:23

Commit b44055f to fluxbb master

Merge pull request #108 from Quy/relprevnext

#963: Add rel=“next” and rel=“prev”

quy 2014-05-07 03:25:59

Commit 8053e04 to fluxbb master

#963: Add rel="canonical".

quy 2014-05-07 03:32:32

After reading this article, I am satisfy with the pull request.

Last question: Should these URLs be absolute?

Franz 2014-05-07 07:26:40

Yes, absolute URLs are always better. smile

Franz 2014-05-07 07:33:31

Commit e993152 to fluxbb master

Merge pull request #109 from Quy/relcanonical

#963: Add rel="canonical".

quy 2014-05-07 13:24:36

  • Status changed from open to fixed.
  • Summary changed from 301 redirect for bad links. to Add rel="prev", rel="next" and rel="canonical".

Thanks guys for the assistance.

Mpok 2014-05-08 05:56:54


Would check your "canonical" tho.
As i read above, u linked 'canonical' with 'prev' and 'next' features. Which are NOT linked… sad
- 'canonical' have NO LINK with pagination.
- canonical link IS NOT the first page.
- 'canonical' is "straight related" with 'rewrite' feature. So it have to be treaten softly…

quy 2014-05-09 02:12:18

- 'canonical' have NO LINK with pagination.

[Per this article, it is okay to do.

- canonical link IS NOT the first page.

Please go here and read:
Mistake 1: rel=canonical to the first page of a paginated series

- 'canonical' is "straight related" with 'rewrite' feature. So it have to be treaten softly…

It is my understanding that canonical tag deals with duplicate content issues like this case where the topic id and post id point to the same page: … 837#p54837

If you have current information contradicting the above, please let me know and I will adjust accordingly. Thanks.

Franz 2014-10-20 11:51:23

  • Milestone changed from 1.5.7 to 1.5.8.