Support » Fixing WordPress » Apache mod_rewrite server usage

  • Hello WP Folks,

    I thought I would post my learning experience today, in hopes that it might help someone else. I welcome comments and ideas and corrections as I’m a WP newbie. My tech guys were very helpful in teaching me what was happening on the server end, and I’d like very much to post here soon and say “my host is a great place for your WP installation!”

    I set up WP in a subdirectory, then decided I wanted to run the blog from the main or root directory of my site. So I followed the directions at

    Those directions say:
    5. Finally if you’re using the mod_rewrite option for your blog URIs you’ll need to go to Options Ò€º Permalinks to get the new rewrite rules and copy those to a .htaccess file at the root of your site.

    My first mistake was to get fancy and just copy the .htaccess file up to the html root. I now had one in /html/wordpress and another one in /html/ .

    My second mistake was to then go run Options >> Permalinks and update the newly copied .htaccess file.

    The result of this was that I ended up with a .htaccess file left behind in the /wordpress directory, AND a new one in / which, incidentally, now had TWO copies of almost the same information: the set of rules from the original installation, written for the /wordpress subdirectory AND the set of rules created when I ran Options >> Permalinks after setting everything up to run from the root html directory. It seems that since the rules were different, WP didn’t overwrite them, it appended them.

    Since .htaccess is called every time there is an httpd request to any folder, and since it is recursive, reading ALL .htaccess files in folders above it (parent folders), and I had duplicate rules, I had a major loop going — mod_rewrite was being called over and over again.

    I was crippling the server every time I hit a link on my site, since each access of mod_rewrite was using 99% CPU — so I had these major spikes that would not go away unless we killed apache altogether.

    I seem to have brought this under control now, by simply following the directions. And adding one. πŸ™‚

    – deleted BOTH old .htaccess files from both the root html directory, and the wordpress directory
    – created a new .htacccess from scratch (just a blank text file with that name) and uploaded to the root html directory, as per the instructions
    – chmoded the .htaccess file to 766
    – went to the Admin area, Options >> Permalinks and hit the “Update” button, thus creating new mod_rewrite rules in my nice clean .htaccess file

    The instructions do say to make a new .htaccess file….so really the trick is just to FOLLOW DIRECTIONS. πŸ˜‰ But I would recommend that the installation instructions for this option be updated to mention that deleting the original .htaccess is wise!

    This seems to have worked very nicely to solve the problem of server spikes and endless looping of mod_rewrite rules. So if anyone has problems being shut down by your host, check this out and see if it might be the cause of your web hosting company having to move you or suspend your account.

    If I’ve worded anything incorrectly, or been confusing in any way, I trust the WP experts will jump in and correct. As soon as I’m sure that everything is going perfectly, I will post my hosting company’s name so others can consider the services. Our tech team is wonderfully responsive and helpful.

    Marci πŸ™‚

Viewing 1 replies (of 1 total)
  • Thanks for writing this out. We’ve recently been suspended as well and I’m hoping that this will solve it. (we didn’t move our site but we made the .htaccess file again.)

Viewing 1 replies (of 1 total)
  • The topic ‘Apache mod_rewrite server usage’ is closed to new replies.