Latest TweetsVerify any search engine or visitor via CLI Forward-Reverse Lookup…
Perishable Press

WordPress Feedburner HTAccess Redirect for Default (Non-Permalink) Feed URLs

Recently, a client wanted to deliver her blog feed through Feedburner to take advantage of its excellent statistical features. Establishing a Feedburner-delivered feed requires three things: a valid feed URL, a Feedburner account, and a redirect method. For permalink-enabled WordPress feed URLs, configuring the required redirect is straightforward: either install the Feedburner Feedsmith plugin or use an optimized HTAccess technique. Unfortunately, for sites without permalinks enabled, the Feedsmith plugin is effectively useless, and virtually all of the HTAccess methods currently available on the Web are designed for permalink-enabled configurations. In this article, we will modify our existing HTAccess technique to work with default WordPress feed URLs.

Default WordPress Feed Format

By default, WordPress feed URLs look similar to the following:

Main Feed:

Comment Feed:

..depending on your preferred WordPress feed URL. These default (non-permalink) feed URLs employ query-string parameters to specify the type and format of each feed. Unfortunately, these dynamic URL formats do not work with Feedburner’s own Feedsmith redirect plugin. Fortunately, we can skip using a plugin altogether and use a little HTAccess magic instead.

HTAccess Redirect for Permalink-Enabled WordPress Feeds

Let’s review the code required to redirect all permalink-formatted WP feeds:

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_URI}      ^/?(feed.*|comments.*)        [NC]
 RewriteCond %{HTTP_USER_AGENT} !^.*(feedburner|feedvalidator) [NC] 
 RewriteRule ^feed/?.*$         [L,NC,R=302]
 RewriteRule ^comments/?.*$ [L,NC,R=302]

..which works great for redirecting your permalink feeds to your Feedburner feed. To accomplish this, the RewriteCond matches the “feed” or “comments” pattern in the requested URI. The RewriteRule then redirects all matched URLs to the established Feedburner feed. So, to get this HTAccess method to work with default (i.e., dynamic) WordPress feed formats, we need to modify the RewriteCond to match against the QUERY_STRING rather than the REQUEST_URI.

HTAccess Redirect for Default WordPress Feeds

For WordPress sites without permalinks enabled, we must modify our rewrite rules to recognize feed parameters located in the query string of requested URLs. The resulting HTAccess code for redirecting all default (non-permalink/dynamic) WordPress feeds to Feedburner looks like this:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTP_USER_AGENT} !^.*(feedburner|feedvalidator)                        [NC]
 RewriteCond %{QUERY_STRING}     feed=(rss|rss2|atom).*                               [NC]
 RewriteRule ^(.*)$                 [NC,R=302]
 RewriteCond %{QUERY_STRING}     feed=(comments\-rss|comments\-rss2|comments\-atom).* [NC]
 RewriteRule ^(.*)$                 [L,NC,R=302]

When placed in your site’s root HTAccess file (or Apache config file), this code will redirect all requests for your default WordPress feeds to your specified Feedburner feed. Simply edit the “ContentFeed” and “CommentFeed” portion of the RewriteRule to match the corresponding Feedburner URLs. No other editing is required. This code will match and redirect all requests (unless from FeedBurner or FeedValidator) for both your main content and comment feeds in any format. As expected, category, archive, and individual comment feeds are not affected by this code. This method is more comprehensive than the Feedsmith plugin, but not so aggresive as to redirect your peripheral feeds (i.e., any feeds other than your main content and main comment feeds).


Before applying new code, it’s always smart to understand its functionality, especially when it comes to HTAccess. Fortunately, this redirect method is fairly straightforward, matching various regex patterns and redirecting them to their new location. As a precautionary measure, the entire method is enclosed within an IfModule container to check that the required Apache module (in this case, mod_rewrite) is available before executing the enclosed directives.

Within this container, the first step is to enable the RewriteEngine. If the RewriteEngine has already been enabled, this directive may be omitted. The remaining four lines of this method accomplish the matching of the desired feed URLs and their subsequent redirection to the specified Feedburner feeds. To do this, first RewriteCond directive checks that the user agent is neither feedburner nor feedvalidator (case-insensitive match courtesy of the [NC] flag). The two subsequent RewriteCond directives then match any instances of the default feed parameters (e.g., atom, rss, rss2) in the QUERY_STRING of the requested URL.

Finally, any URLs that are matched by the RewriteConditions are rewritten to their specified Feedburner URL. As this temporary redirect occurs, the query string is removed from the rewritten URL via the question mark appearing near the end of each RewriteRule.

Of course, that is merely an overview of the process; there is of course much more happening both logically and functionally, but this article is getting long enough as it is, and I certainly wouldn’t want to bore you with all of the in-depth technical details. Perhaps I will dig into the deeper mechanics of such methods in a future article..

Redirect Only the Main Feed

For the record, here is the code required to redirect only the main RSS2 feed to Feedburner:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{QUERY_STRING}     feed=rss2                                [NC]
 RewriteCond %{HTTP_USER_AGENT} !^.*(feedburner|feedvalidator)            [NC] 
 RewriteRule ^(.*)$     [L,NC,R=302]

As before, the only edit that needs to be made is to change the “ContentFeed” portion of the RewriteRule to match the URL of the target Feedburner feed. Once in place, this method will redirect all requests (except for those from Feedburner and FeedValidator) for your main feed to the specified Feedburner URL. Customize as needed to suit your specific needs.

Later Daze

If you need to redirect the default, non-permalink versions of your WordPress feed URLs to their associated Feedburner accounts, the HTAccess techniques presented in this article will do the job nicely. Once the code is in place, test that everything is working by accessing your feed directly using its default (i.e., non-redirected) URL. After that, you can sit back, relax, and enjoy all the benefits of WordPress, Feedburner, and one less plugin to worry about.

Jeff Starr
About the Author Jeff Starr = Creative thinker. Passionate about free and open Web.
18 responses
  1. Btw, I also have a wordpress installation at and none of those rss feeds are working either.

  2. No, that’s what I thought at first, but I’ve only got the WP Permalink htaccess rules:

    # BEGIN WordPress

    Options +FollowSymLinks
    Options -MultiViews
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    Although I add both of the “Options” lines in an attempt to troubleshoot, but it doesn’t seem to work either way!

  3. How would one modify the .htaccess code given here to work with feedblitz? Or is there a better way to work with feedblitz?

  4. Jeff Starr

    Hmmm… not sure about Feedblitz code – haven’t switched from Feedburner.. yet. I would be surprised if Feedblitz didn’t provide that information somewhere on their site.

  5. Thank you so much for this code! I have been searching for this for a couple of weeks now and I finally found my answer on Kimberly Castleberry’s blog where she credits you. Now I have both the solution and another blog to follow! :)

  6. Recently , i change my website permalink from category/postname to %postname%.html

    Now problem is that , i m getting crawl error for all the post with .html extension

    (postname).html/feed 404 (Not found)

    What can be done to clear this issue !
    Even trackbacks are also not working !

    Many thanks in Advance!

[ Comments are closed for this post ]