#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)
Change History (10)
#2
@
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
@
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
@
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
@
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patch