title: How to disable mod_security and mod_security2 in .htaccess
body: <p>I've created a Wordpress plugin which became popular but I'm getting lots of complaints that it's not working. After logging in to many user's WP websites(after asking for admin password) I noticed that the last problem I can't easily solve is mod_security and mod_security2 blocking some AJAX requests or .htaccess which is causing 500 error on some configurations.</p>
  
  <p>So first of all why is this piece of code causing some servers to return 500 error</p>
  
  <pre><code>&lt;IfModule mod_security2.c&gt;
    SecRuleRemoveById 300015
    SecRuleRemoveById 300016
    SecRuleRemoveById 300017
    SecRuleRemoveById 950907
    SecRuleRemoveById 950005
    SecRuleRemoveById 950006
    SecRuleRemoveById 960008
    SecRuleRemoveById 960011
    SecRuleRemoveById 960904
    SecRuleRemoveById phpids-17
    SecRuleRemoveById phpids-20
    SecRuleRemoveById phpids-21
    SecRuleRemoveById phpids-30
    SecRuleRemoveById phpids-61
  </code></pre>
  
  <p>
  on other servers removing rules by id this way is causing 500 error:</p>
  
  <pre><code>&lt;IfModule mod_security.c&gt;
    SecRuleRemoveById 300015
    ...
    SecRuleRemoveById phpids-61
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>so for now the only working thing which is not causing any server to crash is</p>
  
  <pre><code>&lt;IfModule mod_security.c&gt;
    SecFilterEngine Off
    SecFilterScanPOST Off
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>but it's not enough for servers with mod_security2 !</p>
  
  <p>How to write a cross-server .htaccess file, and what IF conditions should I add to disable mod_security and mod_security2 anywhere where it applies and not cause 500 errors on other configurations?</p>
  
  <p>Edit:
  Not only in Apache. Anywhere where .htaccess is used.</p>