Although WP Super Cache includes feeds, there is still an overhead that I wanted to reduce. Not to mention the thrashing by Automattic’s feed reader when a blog on wordpress.com has the feed in a widget. Here's a simple solution I came up with.
(1) Add a cron job to run as often as necessary (depending on how often it needs updating; this example is twice a day at 9:24):
24 9,21 * * * wget -q -O - 'https://www.domain.org/feed/' > /home/domainownner/public_html/feed.xml
(2) Add a rewrite to htaccess:
RewriteCond %{REQUEST_URI} /feed/
# The following exempts the domain’s own IP,
# so that the Crontab command itself is not redirected
RewriteCond %{REMOTE_ADDR} !^000\.000\.000\.000
RewriteRule ^(.*)$ https://www.domain.org/feed.xml [L,R=301]
That's it.
I also looked at a few weeks of access logs to see what other feeds (category and tag) had high numbers of requests, and added them as well, e.g.:
25 9 * * * wget -q -O - 'https://www.domain.org/category/topic/feed/' > /home/domainownner/public_html/feed-topic.xml
RewriteCond %{REQUEST_URI} /category/topic/feed/
RewriteCond %{REMOTE_ADDR} !^000\.000\.000\.000
RewriteRule ^(.*)$ https://www.domain.org/feed-topic.xml [L,R=301]
Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts
November 14, 2026
Create static xml for Wordpress feeds to reduce processing burden
Subscribe to:
Posts (Atom)