WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#21278 closed defect (bug) (duplicate)

Canonical redirect for non-existent singular paged content

Reported by: smub Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.1
Component: Canonical Keywords:
Focuses: Cc:
PR Number:

Description

I'm using version 3.4.1

For ex: we have this article on WPBeginner

http://www.wpbeginner.com/wp-tutorials/how-install-wordpress-cdn-solution-maxcdn/

Anyone can simply add:

http://www.wpbeginner.com/wp-tutorials/how-install-wordpress-cdn-solution-maxcdn/345/

This will resolve the post with the rel="canonical" for the new page which creates duplicate content.

I tried this with @JJJ at WordCamp columbus. This only works with numbers not letters or characters. It has to do something with post pagination even though the article is not split into pages.

Change History (11)

#1 @ocean90
7 years ago

  • Component changed from General to Canonical
  • Milestone changed from Awaiting Review to 3.5

#2 @tommcfarlin
7 years ago

I can't reproduce this in any theme that's currently located in trunk. The steps I'm following to attempt to reproduce are:

  1. Navigate to a single post (i.e., /hello-word/)
  1. View source to check the canonical value ( reads <link rel='canonical' href='http://localhost/dev/wordpress/trunk/hello-world/' /> )
  1. Append a series of digits after the URL (i.e., /hello-word/1234/)
  1. View source to check the canonical URL ( still reads: <link rel='canonical' href='http://localhost/dev/wordpress/trunk/hello-world/' /> )

I've also tried this with Twenty Ten and Twenty Eleven in WordPress 3.4.1 and the canonical URL still renders appropriately regardless of paged value.

Would like to dig into a bit deeper - what theme were you using when seeing this behavior?

#3 @SergeyBiryukov
7 years ago

  • Keywords reporter-feedback added; needs-patch removed

Could not reproduce on Twenty Eleven or Twenty Twelve either.

Looking at rel_canonical(), it should always return just the permalink, without additional numbers:
http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/link-template.php#L2290

#4 @ocean90
7 years ago

  • Milestone changed from 3.5 to Awaiting Review

I could reproduce it, but forget that I had a SEO plugin active which adds the canonical link and has this bug.

smub, any SEO plugins active?

#5 @smub
7 years ago

Yikes. Yes, I had WordPress SEO by Yoast plugin active when trying this out. Disabled it, and it seemed to fix the issue. Tried All in One SEO pack, and that one did not have a bug. I guess, I need to start a thread for Yoast.

#6 @SergeyBiryukov
7 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

#7 @sirzooro
7 years ago

  • Cc sirzooro added
  • Keywords needs-patch added
  • Resolution invalid deleted
  • Status changed from closed to reopened

There is another issue here: these URLs are invalid, so in my opinion WP should either return 404 error or perform caconical redirect to URL without page number appended.

#8 @SergeyBiryukov
7 years ago

  • Milestone set to Awaiting Review
  • Summary changed from Infinite Duplicate Content (improper rel="canonical" for non-existant paged content) to Canonical redirect for non-existent singular paged content

Related: #11857 (for archive pages)

#9 @sirzooro
7 years ago

As I checked, this also happens for paginated comments (e.g. .../post-title/comment-page-4/). Need to fix this too.

#10 @SergeyBiryukov
7 years ago

Closed #21464 as a duplicate.

#11 @SergeyBiryukov
7 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

This is actually a duplicate of #11694.

Note: See TracTickets for help on using tickets.