This guide explains how to fix the mod_security error. A server-side problem called Mod_Security could cause the following error:
Error Message: “Not acceptable! An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.”
Here are a few approaches to resolve this error:
- Contact Your Hosting Provider:
Since this is a server-side issue, the easiest and safest solution is to reach out to your hosting provider. Explain the issue to their support team, and they can either disable specific Mod_Security rules or whitelist the affected page to resolve the error. - Disable Mod_Security through the .htaccess file:
This method is not recommended as it disables the entire Mod_Security module, which could compromise your website’s security. If you still want to try it, follow these steps:- Back up your .htaccess file from the ‘wp-admin’ directory.Create a new ‘.htaccess’ file using any text editor and add the following code:
<IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>
- Upload the new .htaccess file to the wp-admin directory on your server.If this doesn’t resolve the issue, you can also try the following:
- Back up your .htaccess file in the public_html directory.
- Open the .htaccess file with a text editor and add this code:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
- Upload the modified file to the public_html directory.
- Back up your .htaccess file from the ‘wp-admin’ directory.Create a new ‘.htaccess’ file using any text editor and add the following code:
- Disable Mod_Security for Specific URLs
A more secure option is to disable Mod_Security only for certain URLs. To do this, use the following code, which targets specific paths (such as /admin/):<IfModule mod_security.c> <If "%{REQUEST_URI} =~ m#/admin/#"> SecFilterEngine Off SecFilterScanPOST Off </If> </IfModule>
Disabling Mod_Security can resolve the error, but before implementing any changes, it is always a good idea to consult your hosting provider to ensure that you are not compromising your site’s security.
That is it!