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)

[code]

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

[/code]

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.

5 Replies to “Fix for 404 error while updating and editing posts”

  1. Thank you I had been searching the WordPress blog all day and I came to your site and I realized the problem was the mod_security setting. Thank you!

  2. 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

Leave a Reply

Your email address will not be published. Required fields are marked *