Make WordPress Core


Ignore:
Timestamp:
04/30/2020 12:03:11 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Canonical: Redirect paged requests for non-paginated posts to the post permalink.

This avoids displaying duplicate content of the same post under different URLs and ensures the canonical URL is correct.

Previously, requests for invalid page numbers were only redirected to the post permalink if the post was actually paginated using the <!--nextpage--> marker.

Follow-up to [34492].

Props jeremyfelt, prografika, sachit.tandukar, subrataemfluence, hronak, ekatherine, henry.wright, chesio, dd32, SergeyBiryukov.
Fixes #40773. See #45337, #28081, #11694.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/canonical.php

    r47122 r47727  
    176176            array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
    177177
     178            array( '/2008/03/03/comment-test/3/', '/2008/03/03/comment-test/' ),
     179            array( '/2008/03/03/comment-test/?page=3', '/2008/03/03/comment-test/' ),
     180
    178181            // Comments.
    179182            array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ),
Note: See TracChangeset for help on using the changeset viewer.