#15950 closed enhancement (wontfix)
Tweak canonical redirect name requests
| Reported by: |
|
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)
Change History (10)
#2
@
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
@
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
@
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
@
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.
Patch