Learning About Mod_security and Disabling Mod_security Carrie SmahaUpdated on May 5, 2025 3 Minute Read Mod_security is an apache module that helps to protect your website from various attacks. It is used to block commonly known exploits by use of regular expressions and rule sets and is enabled on all InMotion web hosting plans. Mod_Security can potentially block common code injection attacks which strengthens the security of the server. If you need to disable the mod_security rules we can show you how, and help you do so. When coding a dynamic website, sometimes users forget to write code to help prevent hacks by doing things such as validating input. Mod_security can help in some cases those users that run sites that don’t have security checks in their code. This is a simple SQL injection where visiting this would cause the database to DROP and delete the users table from the database: https://www.webapp.com/login.php?username=admin'”>DROP%20TABLE%20users– If you are running Mod_security on your server it will block this from running. Typically, you would see a 406 error in this case if mod_security is enabled. To read more about 406 errors read our article. You set up rules for Mod_security to check http requests against and determine if a threat is present. Recognizing Mod_security is pretty easy. Any website that calls a string forbidden by a mod_security rule will give a 406 error instead of displaying the page. On our shared servers, if you would like to disable mod_security for one or all of your domains, this can be done using our Modsec manager plugin for cPanel. If you’d like to simply disable a certain rule that is being triggered instead of disabling mod_security for the entire domain, please contact our Live Support team. If you are a VPS or Dedicated hosting customer you can disable mod_security for the entire server as well. This can be accomplished in WHM by selecting “No Configuration” from WHM >Mod Security. Please take note that mod_security is enabled as an extra layer of security and removing it can expose you to potential risks. Manually Disabling Mod_Security on a VPS or Dedicated Server Some applications may require you to disable mod_security for them to function correctly. This is perfectly fine and since the set_modsec tool is only available on shared servers you will need to disable mod_security for a single domain: SSH into the server and open the httpd.conf file. Find the VirtualHost entry for that specific domain. Uncomment out the include line that looks like this:Include "/usr/local/apache/conf/userdata/std/2/USERNAME/DOMAIN.COM/*.conf"NOTE: this line tells Apache to INCLUDE into the VirtualHost config ANY file ending in .conf. This is an advanced task and if you are unfamiliar with the command line, we suggest you contact our support team for further assistance. Copy the line you uncommented and mkdirmkdir -p /usr/local/apache/userdata/std/2/USER/DOMAIN.COM Insert the rule to turn off mod_securityecho "SecRuleEngine Off" > /usr/local/apache/userdata/std/2/USER/DOMAIN.COM/modsec.conf Restart Apacheservice httpd restart Disabling Specific Mod_Security Rules on VPS and Dedicated Using SecRuleRemoveById, you can disable individual mod_security rules. To find the ID to disable, you need to look in the apache error log (/usr/local/apache/logs/error_log). You can grep for the domain that is having the problem and ModSecurity to find the problem: grep domain.com /usr/local/apache/logs/error_log | grep ModSecurity These lines will provide a section that looks like this: [id “950004”] The number is the ID of the ModSecurity rule that you will disable. You can then enter the following line in an applicable .htaccess file (replacing the ID of your matched error with the 950004 example used below): SecRuleRemoveById 950004 Note: Do NOT include the SecRuleEngine Off line, as this will totally disable ModSecurity. Share this Article Carrie Smaha Senior Manager Marketing Operations Carrie Smaha is a Senior Marketing Operations leader with over 20 years of experience in digital strategy, web development, and IT project management. She specializes in go-to-market programs and SaaS solutions for WordPress and VPS Hosting, working closely with technical teams and customers to deliver high-performance, scalable platforms. At InMotion Hosting, she drives product marketing initiatives that blend strategic insight with technical depth. More Articles by Carrie Related Articles WP Cerber Security Antispam and Bot Detection Settings WP Cerber Security Tools Search for PunyCode Look-alikes With Hold Integrity IDN Checker How to Secure WordPress using Security Keys and Salts Resetting the cPanel Password in WHM How to Change your root Password in WHM How To Open a Port in UFW How to Stop and Disable Firewalld Content Security Policy (CSP) Headers – Complete Reference Guide Why You Need To Keep Your Website’s PHP Version Up-to-Date