Website Error 406 Not Acceptable

I like to run WordPress websites showing their URL as friendly URLs. The permalink setting of Post name (http://www.example.com/sample-post/) is selected for this.

However, on a new WordPress website after clicking on Save changes I was getting a screen showing a 406 not acceptable error.

406 not acceptable

I investigated making this setting manually, editing the file .htaccess.

The section relevant to the permalinks was empty:

# BEGIN WordPress

# END WordPress

I was expecting something more akin to this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

As a workaround I added in the rewrite code and uploaded to the website. Refreshing the permalink page there was no difference. Reviewing the .htaccess file once more the content between the WordPress lines was once more empty.

Other content within the file was retained an actioned.

Searching the Internet for more details I found reference to ModSecurity.

And here it is on the control panel:

406 not acceptable :control panel modsecurity

Whats the default setting for ModSecurity? Is it active and can it be turned off?

To begin I clicked on the ModSecurity icon.

406 not acceptable :control panel configure modsecurity

In the top row click on the Disable button

406 not acceptable :control panel disable modsecurity

Confirm Disable all.

There you have it: Correcting the 406 Not acceptable error by disabling ModSecurity.