Reduce Your WordPress Resource Usage By Hiding Your RSS Feed Link
In my previous post How to Change Your Default RSS Path in WordPress Without Touching Code, I explained how I was able to move my default RSS Feed on WordPress. But I didn’t explain my reasons for doing so.
Many web hosts will limit the number of executions that can be performed against your account. An execution is counted whenever the server needs to execute a script file. In the case of WordPress users, this means PHP. Every page delivered on WordPress counts as an execution. Regular HTML files and images do not.
If your WordPress web host limits by executions and you need to get your numbers down, read on.
Feedburner manages my RSS Feed and they have for years. So the only purpose of the /feed/ path on my site was to redirect requests to my FeedBurner feed. Because this redirect happens in WordPress, a PHP file handles the task and it counts as an execution.
Caching can help, but it doesn’t help you completely in cases where a single resource gets hammered with requests. My support rep at SiteGround explained it to me like this:
…this means that the feed is cached as much as possible right now, beyond gzip compression and browser caching there is little else that can be done for an RSS feed I’m afraid, The amount of caching will not effect the number of hits towards the RSS feed.
My coffee website INeedCoffee.com, which has been online since 1999 was getting between 50,000–80,000 executions a month just on the WordPress RSS Feed. This meant that every month I was in jeopardy of exceeding my resource limit and most of the problem was the WordPress RSS Feed.
In addition to the caching solution provided by my web host, I also tried a redirect plugin and handling the redirect from the .htaccess file. The plugin did not lower executions and the .htaccess solution may have worked, but since I’m hosting more than one website on the account, this messed up the RSS Feeds for those websites.
Feeding Hungry Bots Without Exceeding Resources
Every minute some bot was asking for my RSS Feed. I only wanted Feedburner to visit my RSS Feed and then somehow get all the other bots to leave my site alone and bother Feedburner.
In How to Change Your Default RSS Path in WordPress Without Touching Code, I explained the basics, but left out the part that lets all the other bots find Feedburner without burning through resources.
- Create new RSS Feed. (see previous article)
- Disable default Wordpress RSS Feed /feed/. (see previous article)
- Update Feedburner account and tell them about the new RSS Feed location.
- Test and Sync that Feed. (the one downside is your RSS users will see duplicate posts once for however many items are in your new RSS feed)
- If you are using a Redirect plugin for your RSS Feed, remove that entry now.
- FTP into your WordPress account (or use the File Manager in cPanel). Create a folder called /feed/. This folder will not exist on the file system. It was delivered via the WordPress engine.
- Add an index.html file inside the newly created /feed/ folder that does a META REFRESH to your Feedburner page. (see sample below, update yours with your own Feedburner URL)
<title>Our RSS Feed</title>
<meta name=”description” content=”RSS Feed”>
<meta name=”ROBOTS” content=”NOINDEX,FOLLOW”>
<meta http-equiv=”refresh” content=”5; url=https://feeds.feedburner.com/ineedcoffee">
<p>Visit Feedburner to subscribe to the <a href=”http://feeds.feedburner.com/ineedcoffee">INeedCoffee RSS Feed</a>.</p>
What we’ve done here in Step 7 is physically place a file at /feed/. This will intercept the request before it gets to WordPress, as the web server will look for an index.html file before it looks for index.php file. And because .html does not count an execution, it will not count against our allotted resource usage.
If for some reason this does not work, your web host should be able to assist. Tell them you need to change the execution order of your feed folder so that .html has priority over .php.
In the sample block, I have the refresh set to 5 seconds. This is just for testing. Once you have confirmed it works, set it to 0 seconds.
Add This to Your Header
Some RSS Readers will not auto-follow the redirects. They need you to point the way. Add this line (with your info) into the Header of your website. WordPress has a few plugins, such as “Insert Headers and Footers” to help you.
<link rel=”alternate” type=”application/rss+xml” title=”YOUR SITE NAME” href=”http://feeds.feedburner.com/YOUR_FEEDBURNER_ID">
I was able to reduce the number of executions to my RSS Feed from around 2,000 a day to about 100. If your WordPress site is close to or exceeding resources, maybe this trick will help you.
And if you are looking for web hosting, I highly recommend SiteGround. They were helpful with me as I worked to solve this problem.
UPDATE JULY 2017:
I have some number to share with everyone. My total hits for May 2017 were 2,394,917. After using the technique in this article my total hits for June 2017 dropped to 429,318! That is an 82% decrease. And during this period total page views increased 15,000.
UPDATE OCTOBER 2017:
I added the section on the Header thanks to a reader.
Disclosure: I am a proud affiliate for SiteGround.