I have a special setup where I serve content purely through a static XML file the content on my blog. A plugin creates the static XML every time a new blog post is published in
/wp-content/folder/my.xml
Great. Now I redirect my users that would normally come via the RSS feed url to this static file via .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# Rewrite feed/ to Static Feed:
RewriteRule ^feed/?$ /wp-content/folder/my.xml [L,T=application/rss+xml]
</IfModule>
# END WordPress
This all works great, it seems – however looking at MySQL it’s under really heavy load from the number of users my server is getting. This is odd as all it’s in theory doing is serving a static XML to them. Looking at the processes in phpmyadmin I see lots of:
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND ...
Which suggests every request for /feed/? is making MySQL activity… why ??
Any ideas?
I believe you’re missing a / at the beginning of your regex, or a
RewriteBase /declaration above it.Try changing your rewrite rule like so: