{"id":652,"date":"2024-12-03T13:07:55","date_gmt":"2024-12-03T13:07:55","guid":{"rendered":"https:\/\/249host.com\/tutorials\/?p=652"},"modified":"2024-12-03T13:09:05","modified_gmt":"2024-12-03T13:09:05","slug":"disable-a-specific-rule-for-mod-security","status":"publish","type":"post","link":"https:\/\/249host.com\/tutorials\/disable-a-specific-rule-for-mod-security\/","title":{"rendered":"How to Disable a Specific Rule for Mod security on a Single Domain"},"content":{"rendered":"<p>In this post you will know how to Disable a Specific Rule for Mod security in <a href=\"https:\/\/www.squarebrothers.com\/dedicated-server-india\/\" target=\"_blank\" rel=\"noopener\">webserver<\/a>.<\/p>\n<p>This article pertains specifically to <a href=\"https:\/\/www.squarebrothers.com\/dedicated-server-india\/\" target=\"_blank\" rel=\"noopener\">Dedicated Servers<\/a> and Virtual Servers. The apache configuration file and the associated Include file are not accessible to shared hosting customers. If you are encountering a 406 error on your site and you own a shared hosting account, Acenet staff will need to perform these steps. If you are the administrator of a <a href=\"https:\/\/www.249host.com\/vps-web-hosting-india\/\">Virtual<\/a> or Dedicated server, you can follow this article to disable a specific mod_security rule for one of your domains.<\/p>\n<h3>Below is the steps to Disable a Specific Rule for Mod security<\/h3>\n<pre>This guide assumes Apache 2.x is running on your server. \r\n<\/pre>\n<p>[1] Open the Apache config file via SSH with your favorite text editor:<\/p>\n<p>[2] Locate the VirtualHost entry for the domain you wish to disable the mod_security rule on.<\/p>\n<p>[3] Near the end of the the user&#8217;s VirtualHost entry, you&#8217;ll see something like:<\/p>\n<div class=\"mw-geshi mw-content-ltr\" dir=\"ltr\">\n<div class=\"bash source-bash\">\n<pre class=\"de1\"><span class=\"co0\"># To customize this VirtualHost use an include file at the following location<\/span>\r\nInclude <span class=\"st0\">\"\/usr\/local\/apache\/conf\/userdata\/std\/2\/&lt;USERNAME&gt;\/&lt;DOMAIN&gt;\/*.conf\"<\/span><\/pre>\n<\/div>\n<\/div>\n<p>Note the path that is listed there. If you don&#8217;t see this line near the end of the VirtualHost entry, create it. As long as it&#8217;s created in the same format noted above, it will persist between Apache config rebuilds. Note that the domain &lt;DOMAIN&gt; must match the domain present within that VirtualHost entry and &lt;USERNAME&gt; must match the username.<\/p>\n<p>[4] Create the *.conf file and any necessary folders in the path noted in step 3.<\/p>\n<p>[5] Open the *.conf and add in these directives:<\/p>\n<div class=\"mw-geshi mw-content-ltr\" dir=\"ltr\">\n<div class=\"bash source-bash\">\n<pre class=\"de1\"><span class=\"sy0\">&lt;<\/span>IfModule mod_security2.c<span class=\"sy0\">&gt;<\/span>\r\n SecRuleRemoveById <span class=\"co0\">######<\/span>\r\n<span class=\"sy0\">&lt;\/<\/span>IfModule<span class=\"sy0\">&gt;<\/span><\/pre>\n<\/div>\n<\/div>\n<p>Replace ###### with the actual Rule number<\/p>\n<p>This will disable a specific mod_security rule and allow our modifications to persist between httpd.conf rebuilds.<\/p>\n<p>[6] Restart Apache<\/p>\n<div class=\"mw-geshi mw-content-ltr\" dir=\"ltr\">\n<div class=\"bash source-bash\">\n<pre class=\"de1\">service httpd graceful<\/pre>\n<\/div>\n<\/div>\n<p>You should now be able to visit the domain for which you disabled this rule without a 406 error being thrown.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post you will know how to Disable a Specific Rule for Mod security in webserver. This article pertains specifically to Dedicated Servers and Virtual Servers. The apache configuration file and the associated Include file are not accessible to shared hosting customers. If you are encountering a 406 error on your site and you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10,1,11],"tags":[],"class_list":["post-652","post","type-post","status-publish","format-standard","hentry","category-control-panel","category-general","category-linux","category-security"],"_links":{"self":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/comments?post=652"}],"version-history":[{"count":5,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/652\/revisions"}],"predecessor-version":[{"id":657,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/652\/revisions\/657"}],"wp:attachment":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/media?parent=652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/categories?post=652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/tags?post=652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}