Drupal 406 error can happen as a result of a number of reasons which include disabling XML-RPC, security restrictions, and so on.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve related Drupal errors.
Sometimes while changing the admin/settings page or while using the Drupal login module, users receive an error as shown below:
An appropriate representation of the requested resource could not be found on this server.
Below, we will look into how to fix this error.
1. Using XMLRPC
To fix the security holes with older versions of XMLRPC libraries, some hosting providers may disable xmlrpc.php scripts. While we enable the BlogAPI module or the Drupal login module on such a provider, our Support Engineers notices "406 errors".
A possible solution here that we follow is to rename the xmlrpc.php file in drupal’s main directory.
We will then alter blogapi.module to point to the newly renamed file, as well as any other modules that point to xmlrpc.php.
2. Special characters in the folder name
At times, the 406 error may trigger due to characters like “/” in the folder name. For instance, we have noticed this error when the field for the temporary directory was set as "/tmp". The leading slash here was creating some chaos in the headers passed from the apache to the browser.
We can fix the error in such cases by changing the folder name to one without the slash character
3. Drupal 406 error due to security settings
The security settings at the server-side may also trigger the 406 error at times. We are able to fix this error by adding the following line to the .htaccess file:
This article covers methods to resolve Drupal 406 error.
There are many errors that you may see as you visit different websites across the web.
One of the more common ones is the 406 – Not Acceptable error.
Cause for Drupal 406 error:
In regards to a site on your hosting account, the cause of the 406 error is usually due to a mod_security rule on the server.
Mod_security is a security module in the Apache web server that is enabled by default on all hosting accounts.
If a site, page, or function violates one of these rules, server may send the 406 Not Acceptable error.
To prevent Drupal 406 Not acceptable error:
Mod_security can be turned off. You can also disable specific ModSecurity rules or disable ModSecurity for each domain individually.
If you would like mod_security disabled you can disable mod_security via our Modsec manager plugin in cPanel.