Reputation: 4575
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?
Upvotes: 0
Views: 150
Reputation: 1
I had a similar problem.
I found that someone was bombarding my MySQL database directly (remote) now and then. They had probably got hold of passwords, don't know how.
I solved it by setting MySQL in 'safe_mode: On' (using CPanel/php.ini EZ Config)
Then I changed the password in CPanel too.
After that my load was reduced dramatically.
Hope that helps,
CGS
Update: The problems came back so the above didn't help. After some more tests I found that it was the Plugin 'WP Stats' that caused a lot of database queries. After I deactivated it I have not seen any more errors.
Upvotes: 0
Reputation: 78473
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:
RewriteBase /
RewriteRule ^(feed/?)?$ /wp-content/folder/my.xml [L,T=application/rss+xml]
Upvotes: 1
Reputation: 10467
Are you sure that this file is generated ONLY when you publish new blog post? The invalid regeneration mechanism is the only reason that comes to my mind.
@Denis also correctly mentioned, that you may not be redirecting to the correct location. Users may enter the path that is going to create XML file on the fly for every request.
Edit:
Credits go to @Denis, but try one of:
RewriteRule ^?feed=rss2$ /wp-content/folder/my.xml [L,T=application/rss+xml]
RewriteRule ^/?feed=rss2$ /wp-content/folder/my.xml [L,T=application/rss+xml]
Upvotes: 1