WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 6 years ago

#23408 closed defect (bug) (fixed)

Link to rss-feed in default installation causes redirect loop

Reported by: clusterone Owned by:
Milestone: 4.4 Priority: normal
Severity: major Version: 3.8
Component: Canonical Keywords:
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 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
8 years 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.

#2 @inorx
7 years 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.

#3 @chriscct7
6 years ago

  • Keywords needs-testing added

#4 @SergeyBiryukov
6 years ago

  • Keywords needs-patch needs-testing removed
  • Milestone changed from Awaiting Review to 4.4
  • Resolution set to fixed
  • Status changed from new to closed

I can no longer reproduce comment:1, appears to be fixed in [34336].

Note: See TracTickets for help on using tickets.