[wp-trac] [WordPress Trac] #8642: Canonical redirect of feed URLs
with suffixes is wrong
WordPress Trac
wp-trac at lists.automattic.com
Wed Dec 17 02:01:28 GMT 2008
#8642: Canonical redirect of feed URLs with suffixes is wrong
----------------------+-----------------------------------------------------
Reporter: jhodgdon | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7.1
Component: General | Version: 2.7
Severity: normal | Keywords: redirect has-patch
----------------------+-----------------------------------------------------
As of [10215] and the 2.7 release, if for some reason I have a URL like
(myblogurl)/feed/(suffix)
then the redirect in wp-includes/canonical.php function
redirect_canonical() redirects this to
(myblogurl)/feed/(suffix)/feed/
and that URL 404s.
The reason this happens is that the redirect_canonical() function, when it
is dealing with feed-related URLs:
1. strips off /feed/ only from the end of the URL
2. checks is_feed() (which returns true if /feed/ is in the URL anywhere)
3. if is_feed() is true, it assumes /feed/ has been completely stripped
from the URL (which it hasn't if the /feed/ is not at the end), and adds
/feed/ to the end of the URL.
The patch I am about to add to this report additionally strips /feed/ off
the middle of the URL, which at least makes the redirect work for me --
then it redirects to
(myblogurl)/(suffix)/feed/
which works just fine.
By the way, there are some other places in the WP code where this
assumption has been made, that certain things are always coming in at the
end of URLs and not in the middle -- I have run into this before in
previous WP versions and gotten around it with annoying shenanigans in my
plugin that adds suffixes to URLs (among other functionality). Some of
these issues are elsewhere in that same canonical_redirect() function, and
some are in the rewrite logic (especially the parts of both having to do
with paging). So if you feel ambitious, you might want to search these out
and fix them. If not, I'd appreciate it if you could at least put this
patch into the 2.7.1 release.
--
Ticket URL: <http://trac.wordpress.org/ticket/8642>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list