Make WordPress Core

Opened 16 years ago

Closed 7 years ago

Last modified 7 years ago

#15950 closed enhancement (wontfix)

Tweak canonical redirect name requests

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

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 16 years ago.

Download all attachments as: .zip

Change History (10)

@johnbillion
16 years ago

#1 @johnbillion
16 years ago

  • Keywords has-patch added
  • Version → 3.1

Patch

#2 @nacin
16 years ago

  • Milestone Awaiting Review → 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
16 years ago

  • Keywords has-patch removed
  • Type enhancement → 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
16 years ago

  • Keywords has-patch added
  • Type defect (bug) → enhancement

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

#5 @dd32
16 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 → wontfix
  • Status new → 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.