EncyclopediaOfLife/eol — comment on commit ef7b6563f13254bf99b4ecb17943ef29ce61e2a1
File: app/controllers/application_controller.rb line 657
By lwalley:

Some context:

Goal of canonical rel is to create a single URL for pages that serve duplicate content. So in the case of pagination if we take the taxon media tab as an example, the following URLs serve the same content:

/pages/:id/media
/pages/:id/media?page=1

Whereas /pages/:id/media?page=2 serves different content to page 1.

So my goal with the regex is to allow page numbers > 1 but if the param is page=1 (or page=01 as you pointed out) the param should be removed from the canonical URL. The use of .* I agree is a bit casual and we could restrict it to integers only. What would be the best way to write regex to allow any integer value greater than 1?

Side note: whether to treat pagination as unique content or make all paginated content point to the first page is a contentious issue. Google appears to advise against it as their intentions for rel canonical are for duplicate content pages, so I'm waiting for further feedback and this regex may be ditched.