Make WordPress Core

Opened 14 years ago

Closed 11 years ago

#7101 closed defect (bug) (duplicate)

Canonical rewrite misses some category URLs

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


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)

#1 @filosofo
14 years ago

This sounds like it's related to #5989

#2 @ryan
13 years ago

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

#3 @ryan
13 years ago

  • Milestone changed from 2.9 to Future Release

#4 @dd32
11 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.