title: Using spaces in URL and .htaccess
body: <p>I wrote a local name/phone/address search engine for my city.</p>
  
  <p>Users must be able to quick-access the results by going to either of these urls:</p>
  
  <ol>
  <li><strong>search by number</strong>
  <ul>
  <li><a href="http://domain.com/5554651" rel="noreferrer">http://domain.com/5554651</a></li>
  </ul></li>
  <li><strong>search by lastname</strong>
  <ul>
  <li><a href="http://domain.com/smith" rel="noreferrer">http://domain.com/smith</a></li>
  <li><a href="http://domain.com/smith%20johnson" rel="noreferrer">http://domain.com/smith%20johnson</a></li>
  </ul></li>
  <li><strong>search by lastname and first name</strong>
  <ul>
  <li><a href="http://domain.com/smith/andrew" rel="noreferrer">http://domain.com/smith/andrew</a></li>
  <li><a href="http://domain.com/smith%20johnson/mary%20elizabeth" rel="noreferrer">http://domain.com/smith%20johnson/mary%20elizabeth</a></li>
  </ul></li>
  </ol>
  
  <p>This is my current .htaccess config:</p>
  
  <pre><code># Smart links
  RewriteRule ^([0-9]+)$ /html/index.php?phone=$1 [QSA,L]
  RewriteRule ^([A-Za-z-]+)$ /html/index.php?lastname=$1 [QSA,L]
  RewriteRule ^([A-Za-z-]+)/([A-Za-z-]+)$ /html/index.php?lastname=$1&amp;name=$2 [QSA,L]
  </code></pre>
  
  <p>That works pretty well, except if the user includes a space in the lastname and/or first name. Also, no numbers can be used when searching for names.</p>
  
  <p>Any ideas on how to allow spaces in the url? Thanks!</p>