Add below mod rewrite rules into .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{QUERY_STRING} !^s=.*
RewriteCond %{QUERY_STRING} !^q=.*
RewriteCond %{QUERY_STRING} !^url=.*
RewriteCond %{QUERY_STRING} !^ver=.*
RewriteCond %{REQUEST_URI} !^/wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>
Basically above code will block all wp-cron.php jobs ?
NOTE: we have recently added url pattern which is required for all WordPress Embed functionality and ver pattern which is required to load style.css or other files with version number as parameter.
Let’s understand this block:
- Ignore all query string in URL and redirect to your blog URL
- If query string contains
?s=and?q=then only it’s allow. Sample:- https://crunchify.com/search/?q=wp%20super%20cache
- https://crunchify.com/?s=wordpress
- Ignore this rule if URL contains
wp-admin
After enabling above rule too, I saw significant improvement on Memory and CPU usage and it's nearly zero. Also – entry process was almost reached to zero(0). That means visitors were served cached page almost all the time.
This post will helps you also if you have below problem and it’s part of WordPress optimization tips.