title: Dynamic Serving with Mod_rewrite
body: <p>I put a <code>mod_rewrite</code> rule in <code>httpd.conf</code> to try to handle mobile requests.  If the browser on the sending device accepts mobile stuff, I want to rewrite the request to the original file name with an "m_" in front.  So if a mobile device sends:</p>
  
  <pre><code>https://example.com/51/a1.html
  </code></pre>
  
  <p>I want to rewrite it to</p>
  
  <pre><code> https://example.com/51/m_a1.html
  </code></pre>
  
  <p>I have the lines below now in httpd.conf:</p>
  
  <pre><code>RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC]
  
  RewriteRule ^example.com/([0-9]*)/(.*)$ ^example.com/$1/m_$2
  </code></pre>
  
  <p>But requests from a mobile device don't get rewritten. 
  Does anyone see a problem?</p>
  
  <p>Thanks.</p>