Fix for 404 error while updating and editing posts

Yesterday when I was trying to publish a post it was redirecting me to 404 error page. The problem was with only one particular page and it was some way related to the post content. I was able to save the post when I removed some part of the post. I tried a lot of things like

  • Disabling plugins
  • Activating the default theme
  • Updating and reinstalling WordPress
  • Rewriting htaccess and updating permalinks

Nothing helped, some of the threads on this problem referred to mod_security rules. The problem was due to the mod security rules. As my post had some strings that directly relate to security issues. These obviously triggered some mod_security rules I had to disable mod_security rules temporarily to publish the post.

This is what I added to /usr/local/apache/conf/modsec2/whitelist.conf, (location may be different in your case)


<LocationMatch "/wp-admin/*">
 SecRuleRemoveById 300015
</LocationMatch>

If don’t have the permissions to edit mod_security rules, ask your hosting support team to update them for you. You may want to show this post as reference to them.

4 Comments Post a Comment
  1. ally says:

    this is good, thanks for good info. just learned something new with wordpress ;)

  2. Dave Starr says:

    Thanks so much for this info.  Indeed I have been having this problem for weeks now, blaming it on my Internet service provider (until I tried updating from another provider).  makes WordPress near unusable unless one sues a third-party editor, like Windows live writer.  I wonder how my server provider is going to react when I spring this on them

  3. I found that problem in my blog.

Leave a Reply




Download SWIFT