title: Rewrite underscore to hyphen in existing set of mod_rewrite rules
body: <p>I have this set of rules in my .htaccess and I would like to add additional rule (or change existing) so that all underscores in URLs are rewritten to hyphens.</p>
  
  <pre><code>RewriteEngine on
  
  #1--Redirect  "/?load=/foo" to "/foo"--#
  RewriteCond %{THE_REQUEST} /\?load=/([^\s&amp;]+) [NC]
  RewriteRule ^ /%1? [NE,L,R]
  #2--Rewrite "/foo" to "/?load=/foo--#
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.+)/?$ /?load=/$1 [NC,L,QSA]
  </code></pre>
  
  <p>Also, is there a way to limit the number of consecutive hyphens? Rewriting <code>_</code> to <code>-</code> on some URLs gives me results like <code>file---data---backup</code>, since the original URL had a hyphen between two underscores. Could I somehow turn such URLs into e.g. <code>file-data-backup</code> instead?</p>