WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 3 years ago

#23602 new defect (bug)

Incorrect canonical redirect if p=123 query argument present in "paged" archives

Reported by: kasparsd Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.5
Component: Canonical Keywords: needs-patch needs-unit-tests
Focuses: Cc:

Description

URLs that include page/n AND p=n query variable, such as:

http://example.com/page/3/?p=123

will issue a 301 redirect to the homepage. This is being reported as incorrect behaviour in Google Webmaster Tools, because:

The target URL does not exist and your server is not returning a 404 (file not found) error.

Your server is redirecting requests for a non-existent page, instead of returning a 404 response code. This creates a poor experience for searchers and search engines.

A fix would be to strip the p= query variable and redirect to the paged archive.

From:

http://example.com/page/3/?p=123

to:

http://example.com/page/3/

Change History (2)

#1 @wonderboymusic
4 years ago

  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release

maybe not this release, but at some point, I am going to make all 50 of the skipped canonical unit tests work - this can be part of it

#2 @chriscct7
3 years ago

@wonderboymusic did you do this? Not seeing those tests in the travis output

Note: See TracTickets for help on using tickets.