WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 4 years ago

#7101 closed defect (bug) (duplicate)

Canonical rewrite misses some category URLs

Reported by: jhodgdon Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version: 2.5.1
Component: Canonical Keywords: canonical rewrite
Focuses: Cc:

Description

My understanding of the canonical rewrite functionality in WordPress is that it should rewrite all URLs to their canonical form. For instance, it will take

[blog home]/?cat=[ID]

and redirect you to

[blog home]/category/[cat slug]

(assuming you have permalinks, and "category" is your category base)

But this is not working for all legal category URLs, at least under some permalink structures. To reproduce:

a) Set your permalink structure to /%category%/%postname%/

b) Type in a URL

[blog home]/[cat slug]

You will find this takes you to the category page for that category, but the URL is not rewritten to its canonical form, which should be

[blog home]/category/[cat slug]

The reason this lack of rewriting is a problem is that the pagination URLs on this page are incorrect -- they lead to 404 errors -- see #5331

Note that the category URLs generated by functions such as wp_list_categories or whatever are in the correct form, but if someone visits a single-post page and then removes the post slug at the end of the URL, they will get to the incorrect category page. Its URL should be canonically rewritten, but it isn't.

This was tested in the 2.5.1 release.

Change History (4)

comment:1 @filosofo7 years ago

This sounds like it's related to #5989

comment:2 @ryan6 years ago

  • Component changed from General to Canonical
  • Owner changed from anonymous to markjaquith

comment:3 @ryan6 years ago

  • Milestone changed from 2.9 to Future Release

comment:4 @dd324 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This has since been fixed, in 3.0 via #11907

Note: See TracTickets for help on using tickets.