While managing a WordPress website, you may encounter with some common errors, from which, 406 is also something you should learn about.
Not everyone sees such an error, but it refrains you from accessing a site. You need to learn about its cause and the solution.
When someone types an address of a website on the browser, the web browser sends a request to the server in the form of "Accept Header," and when the server doesn't find any file type browser asks, it displays 406 error.
Most of the times, the error occurs due to mod_security, a protocol web hosting companies apply to protect a website. If it tracks any violation of the rules, a 406 error or not acceptable error is shown on the screen.
In this tutorial, you're going to learn about solving the 406 or not acceptable error by disabling mod_security through the .htaccess file using cPanel.
I am sure; you already know how to edit such a core file.
Add a Code to .htaccess to Fix 406 Error
Once in a while, people start fretting about using WordPress CMS (Content Management System), but they stick to it because there are tons of solutions to a problem.
You get an error, and the community offers you many solutions. As you know, the majority of people use shared web hostings, which offers cPanel.
So, learning the basics of cPanel can help you deal with problems related to your website. Let me start the process.
Login to your cPanel account and start searching for the file manager icon under the files' section.
It's possible that you see an independent icon because of a different web hosting company. Every company tries to maintain its brand value, even in the cPanel layout.
As you know, Bluehost uses blue as their brand color, and other companies use their design template for cPanel.
As always, you need to make sure, you see the public_html directory. Depending on the web hosting you have, you may also see the home directory after opening the file manager.
You can open public_html by navigating to it from the left-hand sidebar. If you host multiple websites on the same server, you need to open the folder where WordPress installation is available of your domain.
Find the .htaccess file and right-click to edit.
Note: If you don't see the file, it's because your settings to disable hidden files isn't active. Go to the top-right corner, click on the gear button, and tick the checkbox to display hidden files.
After choosing an edit option, you see a popup asking to disable encoding if you wish. You have to click on the Edit button to continue.
On a new tab, you can see many rewrite rules. You have to add the code to the .htaccess file.
<IfModule mod_security.c> SecFilterEngineOff SecFilterScanPOSTOff </IfModule>
Save the file by clicking on the Save Changes button from the top-right corner of the screen. Now you can try opening your website after clearing the browser cache and cookies.
Sometimes, even after making the changes, you don't see anything because the browser loads the older version of the site. Clearing the cache helps you understand all the changes you have made on your WordPress website.
Congrats, you have completed your task.
Can You Now Fix 406 or Not Acceptable Error
WordPress can be scary at times, but once you learn its basics, you can never complain. As you know, WordPress has the world's most significant community, and people are taking their work seriously.
Although you may see the standard WordPress errors during your journey, every error has a solution. Dealing with a 406 error is easy.
It's possible that you can see 406 or not acceptable error only while opening your WordPress website through a mobile phone, not a computer.
If you have understood the concept, the browser may be creating the problem. Sometimes, checking your site on a different browser works.
Check out these top 3 WordPress hosting services: