title: Using rewrite mod in .htaccess
body: <p>I'd like to write a rewrite rule to do the following: if any of the following files exist on the server as a static html file in a specific directory then I'd like .htaccess to serve that static file. Otherwise, I'd like the id (<strong>first number</strong> after the <strong>.com/</strong> and before the <strong>first hyphen</strong>) to be passed as a query parameter to <code>www.gallery.com/index.php</code></p>
  
  <p>Redirect should occur for the following URLs if it doesn't exist as a static HTML page.  </p>
  
  <pre><code> www.gallery.com/2-swimming.html
   www.gallery.com/2
   gallery.com/2
  </code></pre>
  
  <p>Below is my entire .htaccess file</p>
  
  <pre><code>&lt;Files .htaccess&gt; 
     order allow,deny 
     deny from all 
  &lt;/Files&gt; 
  
  
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteCond %{REQUEST_FILENANE} !-f
  RewriteCond %{REQUEST_FILENANE} !-d
  RewriteRule ^([0-9]+)-(.*)\.html$ /index.php?id=$1 [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>Is there anything wrong with my rewrite condition.(I'm having a hard time). Also what is an efficient way to grab the id incase of a redirect. </p>