Make WordPress Core

Opened 15 years ago

Closed 7 years ago

Last modified 7 years ago

#15950 closed enhancement (wontfix)

Tweak canonical redirect name requests

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Canonical Keywords: dev-feedback needs-patch bulk-reopened
Focuses: Cc:

Description

Scenario: A website has the following two pages:

  • example.com/foo/amazing-thing/
  • example.com/amazing/

Upon requesting example.com/amazin the canonical redirect should favour the top-most level page. This doesn't happen as the relevant SQL query doesn't have an ORDER BY clause, making the behaviour unpredictable.

Attachments (1)

15950.patch (633 bytes) - added by johnbillion 15 years ago.

Download all attachments as: .zip

Change History (10)

@johnbillion
15 years ago

#1 @johnbillion
15 years ago

  • Keywords has-patch added
  • Version set to 3.1

Patch

#2 @nacin
15 years ago

  • Milestone changed from Awaiting Review to Future Release

That would then cause example.com/foo/amazin to be redirected to example.com/amazing/ rather than example.com/foo/amazing/.

#3 @johnbillion
15 years ago

  • Keywords has-patch removed
  • Type changed from enhancement to defect (bug)

This is actually a bug then. Only the last part of the URL (ie. the 'name' query var) is used to guess the correct page.

The resulting SQL when requesting either example.com/foo/amazin or example.com/amazin both look like this:

SELECT ID FROM wp_posts WHERE post_name LIKE 'amazin%' AND post_status = 'publish'.

Not sure how to address this. Not sure if the return on investment in time fixing it is actually worth it.

#4 @nacin
15 years ago

  • Keywords has-patch added
  • Type changed from defect (bug) to enhancement

Never mind then. I just postulated, but forgot about how the query worked.

#5 @dd32
15 years ago

This has bugged me before..

Ideally, My solution would be:

Take the requested uri, strip the homeurl off it. If it looks like a page, AND there is a / in the url, lookup that page, search for children of this page which matches the final component of the uri. If no match, revert to searching all pages.

#6 @chriscct7
12 years ago

@dd32 did you want to revisit this?

#7 @chriscct7
11 years ago

  • Keywords dev-feedback added

#8 @johnbillion
11 years ago

  • Keywords needs-patch added; has-patch removed

#11 @johnbillion
7 years ago

  • Keywords bulk-reopened added
  • Resolution set to wontfix
  • Status changed from new to closed

I would have liked to have seen this fixed, but closing due to lack of interest.

Note: See TracTickets for help on using tickets.