Support » Fixing WordPress » .htaccess high cpu usage

  • hello
    past few months i find out my site has high cpu usage so first things i did was
    1- deleted unnecessary plugins
    2- disable all plugins
    3- changed my host provider
    4- used a cdn:(cloudflare)
    5- tried another cache plugins (mine is wp rocket)
    but problem has never been solved
    after all i find out what the problem is:
    my permalinks are set on post name option and this make some rules in .htaccess file :

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    whenever i try to delete codes above from .htaccess, cpu problem is solve but other page on my site except homepage not loading
    i know solution is to change permalinks to wordpress default but i have more then 200-300 post and 1.5 k visitor daily is not this gonna ruin my website seo ?
    is there another solution ?
    is wordpress gonna fix this in future ?

    • This topic was modified 2 years, 4 months ago by alidarkmaster.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steve Stern (sterndata)


    Forum Moderator & Support Team Volunteer

    There’s nothing to fix; there’s something wrong with your server it it’s taking a lot of resources to process .htaccess. Please contact your host.



    The rewrite rules used by WordPress will funnel all requests for non-existent files and directories into its query parser. The query parser tries to match the request with an internally-stored list of your page names. If there is a match, the appropriate template in your theme is used. If there is no match, the “404” template in your theme is used.

    I suspect your problem is a large number of requests for non-existent pages, most likely coming from hackers who are probing your site for vulnerabilities. Forcing these bogus requests to go through WordPress takes a lot of server resources. Disabling the rewrite rules allows the page requests to be handled by the Apache “404” handler, which is very fast and uses almost no server resources. This would explain why the problem did not go away even after you changed hosting companies, but does go away when you remove the rewrite rules.

    There may be some security plugins that will help with this situation. Some custom mod_security rules would definitely help. Good luck!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘.htaccess high cpu usage’ is closed to new replies.