WordPress.org

Make WordPress Core

Opened 15 months ago

Last modified 3 months ago

#23408 new defect (bug)

Link to rss-feed in default installation causes redirect loop

Reported by: clusterone Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 3.8
Component: Canonical Keywords: needs-patch
Focuses: Cc:

Description

I noticed, that google webmastertools complained about dead links in my blog.
Those links were hidden in the html-code and were links to rss-feeds of attachments. (e.g. ?attachment_id=1647&feed=rss2)
When i try to open the link, it returns a 301 error and if the new url is called, anoter 301 error is shown. After two or three times, the original url is shown again by a 301 error message.

I installed two clean installations on different servers, which show the behaviour either. If i use the link "?attachment_id=1647&feed=rss" the correct feed is loaded. (using rss instead of rss2 which is provided by the template)

It seems that the error is caused by the function get_post_comments_feed_link(...) in "wp-include/link-template.php used wp-include/canonical.php.
When i add another line to the function to return a link with "attachment_id=" and not "p=" or "page_id", the comment feed is loaded without errors.
But the fact, that rss feeds do not cause an error and rss2 feeds create a loop makes me think, that another module may be defect and my workaround is not a solution.

Regards

Fabian

Attachments (1)

23408.patch (636 bytes) - added by SergeyBiryukov 14 months ago.

Download all attachments as: .zip

Change History (3)

comment:1 SergeyBiryukov14 months ago

  • Component changed from Feeds to Canonical

Reproduced the redirect loop with the default permalink structure:

http://trunk.wordpress/?attachment_id=4603&feed=rss2
HTTP/1.1 301 Moved Permanently
Location: http://trunk.wordpress/?feed=rss2&p=4603

http://trunk.wordpress/?feed=rss2&p=4603
HTTP/1.1 301 Moved Permanently
Location: http://trunk.wordpress/?attachment_id=4603&feed=rss2

And so on.

SergeyBiryukov14 months ago

comment:2 inorx3 months ago

  • Keywords needs-patch added
  • Version set to 3.8

I came across this bug too and just applied the patch to Wordpress 3.8. The bug remains unchanged, the elseif statement the patch adds is not even triggered.

Note: See TracTickets for help on using tickets.