Opened 13 years ago
Last modified 5 years ago
#17661 new defect (bug)
Appending date & author based query vars to a permalink overrides the permalink
Reported by: | dd32 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | Canonical | Keywords: | needs-testing has-patch needs-unit-tests needs-refresh |
Focuses: | Cc: |
Description
Some canonical code branches are not properly accounting for extra query variables being specified via the url.
For example, these url's are not handled properly:
/2008/?author=1 redirects to /author/admin/ /author/admin/?year=2008 redirects to /year/2008/ /category/uncategorized/?year=2008 redirects to /2008/
This happens with most date based branches, as once a higher priority canonical rule is hit, the permalink component is ignored.
The canonical code includes a branch to add any "forgotten" $_GET
variables back onto the url, however this doesn't help when it's the rewritten variables are being lost.
Attachments (3)
Change History (7)
Note: See
TracTickets for help on using
tickets.
This is probably happening in a million other combinations as well - here's the problem:
1) the flags for
is_*
are misleading because they are set to true for every present query var, regardless of rewrite structure2) the redirection happens because
redirect_canonical()
says "I'm a year! and the year is in the query string when I want pretty permalinks, redirect me!" - it doesn't, however, check if the year is also the matched query or not.3) /2012/?year=2012 and /?year=2012 should be redirected to /2012/, /{NOT_YEAR}/?year=2012 should not
My patch fixes this for this ticket's use cases - I'm sure there are other cases which could be addressed.