FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Home  »  Htaccess  »  Redirecting RSS to Feedburner

by 18 comments

FeedBurner, the best syndication company in the worldPouring over my system and server logs I noticed that my raw WordPress feed was being accessed by some suspicious looking bots and addresses, a few were even scraping entire posts and republishing them illegally. I was a little intrigued because I had installed the Feedburner.com recommended WordPress plugin to redirect feeds to feedburner- FeedSmith and obviously it wasn't doing what it claimed to do.. Namely, redirect ALL requests for feeds to the feedburner url..


WordPress Feed Rewrites

Using the AskApache RewriteRules Viewer plugin for WordPress, we see exactly what URI's are able to access the feed scripts on a WordPress Blog, at least using internal rewrites. Some of these are quite accessible by everyone when using the FeedBurner recommended plugin, FeedSmith.

wp-atom.php$ == index.php?feed=atom
wp-rdf.php$ == index.php?feed=rdf
wp-rss.php$ == index.php?feed=rss
wp-rss2.php$ == index.php?feed=rss2
wp-feed.php$ == index.php?feed=feed
(.+?)/(feed|rdf|rss|rss2|atom)/?$ == index.php?category_name=$1&feed=$2
wp-commentsrss2.php$ == index.php?feed=rss2&withcomments=1
feed/(feed|rdf|rss|rss2|atom)/?$ == index.php?&feed=$1
(feed|rdf|rss|rss2|atom)/?$ == index.php?&feed=$1
comments/feed/(feed|rdf|rss|rss2|atom)/?$ == index.php?&feed=$1&withcomments=1
comments/(feed|rdf|rss|rss2|atom)/?$ == index.php?&feed=$1&withcomments=1

htaccess code to redirect feed to feedburner

For a non-htaccess solution FeedBurner recommends the following WordPress Plugin FeedBurner Plugin v2.2

# BEGIN WordPress
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</ifmodule>
 
# END WordPress
 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(feed|wp-atom|wp-feed|wp-rss|wp-rdf|wp-commentsrss)(.+) HTTP/ [NC,OR]
RewriteCond %{QUERY_STRING} ^feed [NC]
RewriteCond %{HTTP_USER_AGENT} !^(FeedBurner|FeedValidator) [NC]
RewriteRule .* http://feeds.askapache.com/apache/htaccess? [R=307,L]
RewriteRule ^comments/?.*$ http://feeds.feedburner.com/apache/htaccess/comments [L,R=302]

Using htaccess (preferred)

You need an .htaccess that is created/modified by wordpress via the Permalink/mod-rewrite option. Go to Options>Permalinks in the wordpress administration menu and enable "fancy" urls by adding /%year%/%monthnum%/%day%/%postname%/ at "structure".

blog feed - http://www.askapache.com/feed/feedburner feed - http://feeds.feedburner.com/apache/htaccess

More info on feedburner forum topic

The following is a short quote from that document

If you've had a feed for any length of time, your readers are using your current feed's URL in their news aggregators How can you painlessly migrate their requests from your old server/feed to your newly burned FeedBurner feed, so all of your syndication traffic takes advantage of our services?

Using WordPress Plugins

The Ordered List WordPress FeedBurner Plugin or the Flagrant disregard Feedburner Plugin will simplify the process.

Google actually lets you submit your RSS feed as a sitemap in the webmaster tool!

NOTES:

  • Both the feedburner plugin and the instructions below will only work if you already have an .htaccess that is created/modified by wordpress via the Permalink/mod-rewrite option.
  • If you have index.php in your permalink structure you have to use a hack. This hack only forwards part of the RSS feeds. To forward all of your feeds to feedburner use this hack.
  • If you have WordPress installed into a folder other than your root folder, you may encounter errors. If so, try Thatedeguy's Hack for a workaround.

Finding Your Feed URL

There are times when you want to tell someone your site's feed address or URL, or you need it to submit it to search engines and directories, many of which now accept feed URL submissions. There are four possible URLs for each of your feeds. Any of these will work.

http://example.com/wp-rss.phphttp://example.com/wp-rss2.phphttp://example.com/wp-rdf.phphttp://example.com/wp-atom.php

Or you can access them like this:

http://example.com/?feed=rsshttp://example.com/?feed=rss2http://example.com/?feed=rdfhttp://example.com/?feed=atom

If you are using custom permalinks, you should be able to reach them through this usage:

http://example.com/feed/http://example.com/feed/rss/http://example.com/feed/rss2/http://example.com/feed/rdf/http://example.com/feed/atom/

Alternative .htaccess mod_rewrite fix

I have two feedburner feeds, on for posts and one for comments that I wanted to ensure ALL feed requests of any type would work with - your rewrite list of URLs was very helpful in figuring this out. So I came up with this:

Thanks to Mike Baptiste for contributing this excellent alternative!

# Redirect global post and comment feeds to Feedburner without loading WP
RewriteCond %{REQUEST_URI} ^/(feed|wp-atom|wp-feed|wp-rss|wp-rdf).* [NC,OR]
RewriteCond %{QUERY_STRING} .*feed=.* [NC]
 
# Ditch if they want a comment feed or a feed limited to posts with comments
RewriteCond %{QUERY_STRING} !.*withcomments=.* [NC]
 
# Any specification of a post ID we skip since it's post specific
RewriteCond %{QUERY_STRING} !.*p=.* [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator|Recent) [NC]
RewriteRule .* http://feeds.feedburner.com/PostFeed? [L,R=307]
 
# Comment feeds can be called via /comments, wp-commentsrss2, or withcomments=1 to the main feed script
RewriteCond %{REQUEST_URI} ^/(comments/|wp-commentsrss2).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*withcomments=.*$ [NC]
 
# Calls directly to the feed scripts that include 'withcomments' limit to POSTS with comments
RewriteCond %{REQUEST_URI} !^/(wp-atom|wp-feed|wp-rss|wp-rdf).* [NC]
 
# Any specification of a post ID we skip since it's post specific
RewriteCond %{QUERY_STRING} !.*p=.* [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator|Recent) [NC]
RewriteRule .* http://feeds.feedburner.com/CommentFeed? [L,R=307]

I noticed that when I switched over to Feedburner I stopped having all the individual post and comments feeds.... That is now fixed by only switching to Feedburners feed for /feed/* or /comments/*I had this same issue when I migrated my wordpress feeds to feedburner using 302 redirects in mod_rewrite based on the USER_AGENT.The result was I lost all my other comment and individual post feeds..But I just realized that all I had to do was change the htaccess code to only apply feedburner when the REQUEST_URI is either /feed/ or /comments/ Now it all works perfectly!

Tags

January 7th, 2008

Comments Welcome

  • eBay Blog

    Your guide to using Feedburner with Wordpress seems to be the best I've seen, but I still have some questions:

    1) Is it required to have following URL structure: /%year%/%monthnum%/%day%/%postname%/
    What if I want to use just /%postname%/ (myblog.com/post-name/)?

    2) What I have to do if I want to use MyBrand feature? (I already created necessary CNAME DNS records and enabled that feature in Feedburner account settings)

  • andy

    i am looking for wordpress "yourwebsite.com/feed" redirection back to homepage itself. Sorry if this is not relevant.

    I have to do this because the /feed is appear at search engine, instead of the homepage. Hope to do a permanent redirect 301 back to homepage. Which means disable the /feed page.

    I tried editing the .htaccess. Cant get it work.

  • koes

    I've been looking all over for a possible solution to my problem, but can't seem to find one yet. Maybe you could help:

    I used to use http://blogname/wp-rss2.php?tag=abc to get certain posts with the abc tag. I installed WP feedburner plugin, and am wondering if I could do the same thing (filter by tag).

    Any help is greatly appreciated.

  • http://webdevnews.net/ Aaron D. Campbell

    Is there a way to make feedburner track feeds like this as well: http://webdevnews.net/2008/09/rdf-open-calais-the-semantic-web/feed/ (individual post feeds)?

  • Cindy

    would really appreciate some help.

    Have never had RSS feeds until recent, have used one program - no settings to affect my problem:

    Now if I click RSS on a blog, web automatically goes to google rss "add to reader" webpage.

    HOW TO STOP THIS PLEASE!?

  • Cindy

    found my answer

    In FFox-Feeds
    click subscribe using
    then pick your application

    otherwise automatically redirects to google "add to my reader" page

  • Tarsem SIngh

    By Default "what type of redirection use wordpress??"

  • http://www.pimapenci.com pimapen

    Well that was much simpler than I was expecting. Thanks!

  • http://www.documaga.com Numaga

    I'm having this strange problem for months now. I've spend many hours googling and trying to fix it but didn't succeed yet. The post here is my last hope really, so I hope someone could help me out and finally get the RSS feed working again.

    I think the RSS stopped working when I changed servers. I uploaded the site to another server and I think that created the error.

    I tried so many things, I'll make a list:
    # Downloaded fresh WordPress zip, took all files with "rss" in it and uploaded those to my server, overwriting the old ones. Didn't work.

    The sitemap was outdated as well, at the exact same date as the RSS. I thought yay I found the problem - deleted the sitemap, then re-installed it - new sitemap works now - RSS still doesn't work.

    I've read many things (while googling) about the htaccess file but I'm not really a coding and/or php expert so I didn't know what to do with it really.

    I tried installing several plugins that create RSS feeds, rss buttons, feedburners etc. None got the RSS going again. uninstalled those later. Still no RSS.

    Uploaded the site to the old server again to check if the rss worked - well, it didn't....

    To make a long story short: I think something is terribly wrong in the core files that are responsible for the RSS feed. I'm not a coder really, I'm not experienced with adding lines of PHP to the theme etc so I hope somebody can help me in the right direction.

    I hope there is a way to "reset" the complete RSS feed back to normal. Any help would be extremely greatly appreciated because this problem kept me busy for about 20+ hours now and I'm becoming desperate of fixing this :(

    Please help!

    Chris

  • http://www.OralAnswers.com/ Tom

    Thanks! I used the very last code submitted by Mike Baptiste. I added it ABOVE the wordpress rules and that did the trick. All of the wordpress pages still work great, but I'm wondering if maybe this will slow down my blog slightly... Thanks!

  • http://www.topstockresearch.com Rahul

    Thanks for posting this article and it has been quite helpful in understanding few of the technicalities .
    However I am having some problems in redirecting multiple rss feeds to feedburner, as the feedburner is unable to show updated data .My .htaccess file looks like

    RewriteEngine On
    RewriteBase /
     
    RewriteCond %{HTTP_USER_AGENT} !^(FeedBurner|FeedValidator) [NC]
    RewriteCond %{HTTP_USER_AGENT} .
     
    Redirect 302 /rss/abc.xml http://feeds.feedburner.com/www123com
    Redirect 302 /rss/def.xml http://feeds.feedburner.com/www123com
    Redirect 302 /rss/ghi.xml http://feeds.feedburner.com/www123com

    The first redirect 302 is showing updated data and the rest are showing old data. It would be of great help if you could guide me on this.

    Thanks in advance
    Rahul

  • Pingback: WordPress фиды | С миру по нитке

  • Pingback: What is the correct way to move an rss feed? Is there a temporary workaround for google reader users? - Just just easy answers

  • Pingback: Каналы нвостей | Gorin

  • Pingback: 워드프레스 피드, 워드프레스 내장 피드, 피드 URL 검색, 댓글, 카테고리 및 태그, 저자, 검색 결과, 피드 추가,

  • Visual

    Hi, I am have a website that imports the rss through a widget. I want to include images in the import of info. Currently I only receive text, title, time and date in the rss. What do I need to do to get the images to appear. I use wordpress.

  • Pingback: How to Provide Categories, Tags, Authors, and Posts Feed for WordPress »

  • http://telhacast.com/ Thiago Miro

    If I redirect the feed to Feedburner, when the Feedburner request feed won't Wordpress enter into a eternal looping?

    Sorry if I asked something simple and the answer is obvious....

My Online Tools
WordPress Sites

My Picks

Related Articles
Newest Posts
Twitter

  • The Hacker Playbook - very nice high level overview of attacks  t.co/lHwNVWi61u 
  • Clean Code - A Handbook of Agile Software Craftsmanship  t.co/hnJX0x1qIc 
  • Secrets of the JavaScript Ninja - By my absolute favorite JS hacker John Resig!  t.co/tZ42ljmcCl 
  • Hacking Exposed 7: Network Security Secrets & SolutionsMy all time favorite, basic but thorough and accurate.  t.co/jycW0RDVtZ 
  • Empty words will be no surrogate for cold resolve. Pain is nothing.  t.co/qXjpRxbjCw 
  • REVERSING: Secrets of Reverse Engineering  t.co/GaWo29lWWG 
  • NEUROMANCER  t.co/3OoknUcb5Z 
  • "The Shockwave Rider", by John Brunner (1975 hacker sci-fi)  t.co/ZW56HVUefW 
  • The Rootkit ARSENAL - Escape and Evasion in the Dark Corners of the System  t.co/1FzX6bHgsQ 
  • "We Are Anonymous - Inside the Hacker World of LulzSec, Anonymous, and the Global Cyber Insurgency" better be good!  t.co/GL0cFNiUOq 
  • THE IDEA FACTORY Bell Labs  t.co/FyVhgNwwT5 
  • The Datacenter as a Computer -- Urs Holzle  t.co/M5WIYs1OVg 
  • Now by Steven Levy, "IN THE PLEX"  t.co/PwxtLgqukG 
  • Dreaming in code.... So far, a little boring, but worth the read  t.co/hmeeOjIlfg 

Friends and Recommends
Hacking and Hackers

The use of "hacker" to mean "security breaker" is a confusion on the part of the mass media. We hackers refuse to recognize that meaning, and continue using the word to mean someone who loves to program, someone who enjoys playful cleverness, or the combination of the two. See my article, On Hacking.
-- Richard M. Stallman






[hide]

It's very simple - you read the protocol and write the code. -Bill Joy

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. NCSA HTTPd.
UNIX ® is a registered Trademark of The Open Group. POSIX ® is a registered Trademark of The IEEE.

| Google+ | askapache

Site Map | Contact Webmaster | License and Disclaimer | Terms of Service

↑ TOPMain