title: Difference between $1 vs %1 in .htaccess
body: <p>What is the difference between <code>%1</code> and <code>$1</code> in .htaccess?  </p>
  
  <p>For example,</p>
  
  <pre><code>    #  to remove www  
      RewriteCond %{HTTP_HOST} ^(\w+)\.mydomain\.com [NC]
  
      RewriteRule .* http://mydomain.com/%1 [R=301,L]    
      #    versus
      #    RewriteRule .* http://mydomain.com/$1 [R=301,L]
  </code></pre>
  
  <p>I have been using <a href="http://www.addedbytes.com/download/mod_rewrite-cheat-sheet-v2/pdf/" rel="noreferrer">Dave Child's .htaccess cheat sheet</a> and <a href="http://www.thejackol.com/htaccess-cheatsheet/" rel="noreferrer">Jackol's .htaccess cheat sheet</a> as well as the <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" rel="noreferrer">Apache mod_rewrite docs</a> but additional help would be great.</p>