WordPress on Shared hosting: “406 Not Acceptable error” fix

Last days I ran into some strange behaviour of this blog. I tried to post a new article and save a Draft. It worked good until I uploaded an image. Saving the draft or saving the post was redirecting me to a non-existing page (404 page error) without saving any changes to my article. I was able to recover some data from the browser backup but again saving was not possible and the information lost. Then I close the browser and any backup was lost for good and that was very … very frustrating.

Therefore I searched for solutions… first thing I found on the internet was linked to my permalink structure. Suggestions are to go to Dashboard and then Settings -> Permalink and save again your permalink settings … and again …. 404 error page. Then I chose the default permalink called “Plain” and I was able to save that change. What was even more frustrated was that I was no longer able to come back to my custom settings. I was getting a Not Acceptable error.

Not Acceptable

An appropriate representation of the requested resource /wp-admin/options-permalink.php could not be found on this server.

Additionally, a 406 Not Acceptable error was encountered while trying to use an ErrorDocument to handle the request.

Came back to my article and with so many frustration and tries, I was able to write and publish it … but my entire website was a fiasco with broken links and no traffic from search engines.

Second fix from the internet was changing .htaccess… Actually something related to mod_security. I start digging for documentation and try with .htaccess fix but no results. This step was not solving my problem but brought me closer to it.

If you host permit, adding the following lines to your .htaccess file will disable your mod_security and fix your problem:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

In my case this was not working … but I had the inspiration to check in my CPANEL for Mod Security settings. And I was lucky. 1. In CPANEL in the security section you can find ModSecurity:

2. Disable it for your website (be aware of the risks and do it permanently or just when is needed then turn it back on):

3. Do your magic on your blog. Changing back your permalink custom settings will work fine, as well as posting and uploading files.

Take your time and read a little bit about Mod Security. And have fun!