Last Updated on 2021-10-17 by Clay
Today when I requested to access my WordPress website through the program, the server returned the following warning message:
Not Acceptable!
An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.
According to the message, we can assume that this error may be in the following two situations:
- Server cannot find the format we request, so ti cannot accept the request
- Server Mod_Security seen the request as a malicious attack
At present, after trying, there should be 3 solutions:
- Clear Cookie/Cache (This problem occurs when only web browsing)
- Add
user-agent
andcontent-type
- Edit the .htaccess file (make sure you can recover)
Solutions
Method 1: Clear Cookie/Cache
One type of blocking is that when you repeatedly enter the wrong account and password, the server-side security protection determined that the browser/IP address you are used is the source of malicious attacks, and block the requests.
In this case, you can try to clear the cookie/cache of the browser and try the request again.
Method 2: Add user-agent
and content-type
user-agent
is a field that confirm client information, such as the browser version and operating system, as well as fields that may be confirm during anti-crawlerscontent-type
is a resource request format, it allow the server to know the format we want to request.
Method 2: Edit .htaccess file (make sure you can recover)
Remind again: Please confirm that you can restore the original content of the file.
To put it simply, in the .htaccess file, set Mod_Security to not enable.
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
References
- https://stackoverflow.com/questions/19768681/not-acceptable-error-was-generated-by-mod-security
- https://www.webfulcreations.com/how-to-fix-an-appropriate-representation-of-the-requested-resource-could-not-be-found-on-this-server-this-error-was-generated-by-mod_security-error/
- https://stackoverflow.com/questions/57417799/i-call-api-from-python-i-get-the-response-406-not-acceptable
- https://stackoverflow.com/questions/11031167/why-do-i-get-406-not-acceptable-when-using-wordpress-wp-http