WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#20385 closed defect (bug) (fixed)

/2012/03/individual-post/?page=2 canonical redirects not properly handled

Reported by: markjaquith Owned by: markjaquith
Milestone: 3.4 Priority: high
Severity: blocker Version: 3.4
Component: Canonical Keywords:
Focuses: Cc:

Description

Multipage posts don't have their ?page=X parameter properly redirected to a /X/ URL.

Change History (7)

comment:1 markjaquith2 years ago

  • Owner set to markjaquith
  • Resolution set to fixed
  • Status changed from new to closed

In [20397]:

Properly handle paged permalink URLs even when we are not already 301ing. fixes #20385

comment:2 batmoo2 years ago

  • Cc batmoo@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened

This breaks pagination on sites with static front pages: http://example.com/page/2/ gets redirected to http://example.com/2/

Adding a front page check seems to fix that:

if ( is_singular() && ! is_front_page() && get_query_var('page') ) {

comment:3 iamtakashi2 years ago

  • Cc takashi@… added

comment:4 markjaquith2 years ago

  • Keywords needs-unit-tests added
  • Priority changed from normal to high
  • Severity changed from normal to blocker
  • Status changed from reopened to accepted
  • Version set to 3.4

I'll work on this tonight. Needs unit tests!

comment:5 ryan2 years ago

In [20444]:

Don't do a canonical redirect for singular paged pages when on the front-page. This was breaking pagination on sites with a static home page. Props batmoo. see #20385

comment:6 markjaquith2 years ago

Okay, I tried. But our canonical redirect unit tests appear to be fundamentally broken. They simulate an HTTP request. Poorly. I couldn't get the test to fail, even at [20443].

comment:7 markjaquith2 years ago

  • Keywords needs-unit-tests removed
  • Resolution set to fixed
  • Status changed from accepted to closed

Sigh. Nevermind. Figured it out. Stupid typo. Made a unit test for it. The fix is good.

http://unit-tests.trac.wordpress.org/changeset/669/

Note: See TracTickets for help on using tickets.