August 15th, 2012 Add Your Comments Bookmark and Share

Why can nothing ever be straight forward? One of my hosts decided to migrate my account to a new server about a week ago, something which I thought hadn’t had any effect on my websites until about 5 hours ago when I went to update a page on one website and was greated by a lovely “403, Page Forbidden” error. After 3 hours of buggering about I’ve finally got it working, here is how.

To make things worse I’d only just finished adding a new post to that website so I knew it had nothing to do with WordPress. The page in question only contains a couple of hundred words and then it pulls in some dynamic data from a PHP page stored elsewhere, it was this PHP include that was causing all the problems but either way I had to be able to update that WordPress page with the PHP include in place.

First of all the problem, it’s a security issue. Mod_Security can throw some real wobblers if you try and post certain things, it isn’t restricted to WordPress at all. The solution was to disable this security feature whilst I updated the page and then re-enable it afterwards. (This all sounds so simple now, hours I’ve been at this!)

Sooo, long story short, create a .htaccess file in your wp-admin directory with the following text in it:-

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off

This should now do away with any 403 or 503 errors whilst you update your page or post (complete with PHP code or whatever else offending text there was). Once you have your amended post or page saved you can then delete the .htaccess file you created in the wp-admin directory. Simples.