title: Why does a hyphen in a RewriteRule break when in a sub-folder
body: <p>I have a bunch of RewriteRules in .htaccess for SEO purposes. Sample...</p>
  
  <pre><code>RewriteEngine On 
  RewriteRule ^signup$ /signup.php
  RewriteRule ^account$ /account.php
  RewriteRule ^logout$ /logout.php
  RewriteRule ^login$ /login.php
  RewriteRule ^recent-questions$ /recent.php
  RewriteRule ^popular-questions$ /popular.php
  ...
  ...
   (more similar stuff)
  ...
  ...
  RewriteRule ^(.*)/([-_~*a-zA-Z0-9]+)\|([0-9]+)(\/)?$ view.php?title=$1&amp;id=$2&amp;%{QUERY_STRING}
  RewriteRule ^([-_~*a-zA-Z0-9]+)(\/)?$ categories.php?key=$1
  </code></pre>
  
  <p>The system is in a sub-folder "ask" on the server. </p>
  
  <p>They all work fine if I map the folder to <a href="http://ask.mydomain.com" rel="nofollow noreferrer">http://ask.mydomain.com</a></p>
  
  <p>But I don't want to use a sub-domain since I'm adding an existing header &amp; footer managed by other people that share resouces and contains relative links with the main www. website.</p>
  
  <p>When I try to access the folder via <a href="http://www.mydomain.com/ask" rel="nofollow noreferrer">http://www.mydomain.com/ask</a> the RewriteRules with hyphens in them result in 404 errors - the other ones continue to work.</p>
  
  <p>I've already tried escaping the hyphens as - and %2D. The former made no difference. The latter takes me to a completely incorrect page.</p>