title: Mod_security 406 with a '~' in the URL
body: <p>I get a 406 Not Acceptable error while having a URL similar to this:</p>
  
  <pre><code>www.example.com/search/find?q=YSBkZXJwIGZyb20gZGVycA~
  </code></pre>
  
  <p>and it seems to be due to the singular <code>~</code> character. I have to <code>base64_encode()</code> it, using this function:</p>
  
  <pre><code>function base64_url_encode($string = null) {
      return strtr(base64_encode($string), '+/=', '-_~');
  }
  </code></pre>
  
  <p>Because the normal base64 encode generates an un-parseable URL.</p>
  
  <p>I've had a look around and came across this answer: <a href="https://stackoverflow.com/a/20198941/2518525">PHP/Apache Error:406 Not Acceptable</a></p>
  
  <p>Which says to disable Mod_Security with:</p>
  
  <pre><code>&lt;IfModule mod_security.c&gt;
  SecFilterEngine Off
  SecFilterScanPOST Off
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>I know I'll have to probably find a different rewrite for the function above, but how could I fix this as to not receive the error again, if there is any way? </p>