How to Redirect Feed Links to follow.it using .htaccess

Feedburner used to a powerful tool for RSS feeds publishing and subscriber management. However, feedburner will unlikely leave its maintenance mode because there has been no new features yet less features for quite some years. But RSS feed is still an important part of the Web supported by many software such as WordPress. follow.it is one of the good alternatives for managing the RSS feeds.

The post How to Redirect WordPress Feed to Feedburner Using .htaccess introduces how to redirect WordPress RSS feed to feedburner using the powerful .htaccess. Let’s look at how to use .htaccess to redirect feed URLs to follow.it in this post. The method is based on .htaccess so it is content management software neutral and many software like WordPress can be supported.

Let’s use <site domain>/feed?.* (? means one character (like /) and .* means any string) as an example as the original URL. Now we redirect it to follow.it URL https://follow.it/systut .

The idea is: for every request to the URL, first check whether the HTTP_USER_AGENT is from follow.it by matching the HTTP_USER_AGENT string. If HTTP_USER_AGENT matches the follow.it keyword, do nothing so that the feed content will be returned to the follow.it requester. Otherwise, redirect the request to the follow.it URL since it is from a normal users’ browsers or some feed readers. Through this method, the normal user can read the feeds from follow.it, while follow.it can get the original feeds content from the website.

The method
Add these codes to the beginning of the .htaccess file in the directory of the site directory / (because /feed is under /; use different directory according to the site software and path structure):

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_URI}      ^/feed        [NC]
 RewriteCond %{HTTP_USER_AGENT} !^.*(https://follow.it)          [NC]
 RewriteRule ^feed?.*$          http://follow.it/systut  [L,NC,R=302]
</IfModule>

Then you may test it using follow.it and using your own browser to verify that different agents get different content.

Leave a Reply

Your email address will not be published. Required fields are marked *