title: Debugging SEO friendly URLs with mod rewrite
body: <p>I feel like I have a good handle on mod rewrite, but I cannot seem to get this one to work.</p>
  
  <p>My setup: if a page actually exists (i.e. contact.php), then load the "real" page.  Otherwise, assume that the url is a blog entry with a SEO friendly url, and feed that url to my index page as a querystring.</p>
  
  <p>Example: <a href="http://www.example.org/my_latest_post" rel="nofollow noreferrer">http://www.example.org/my_latest_post</a> should be rewritten to <a href="http://www.example.org/index.php?blogurl=my_latest_post" rel="nofollow noreferrer">http://www.example.org/index.php?blogurl=my_latest_post</a></p>
  
  <p>If I take the "ugly" url and paste it into the browser, the page loads fine.  But if I run the SEO friendly url, I get the dreaded 404.</p>
  
  <p>My htaccess file is actually quite light right now.  Some caching stuff, piping XML to PHP (for a dynamic RSS feed), a custom 404 document.  </p>
  
  <p>Here is the relevant mod_rewite stuff:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule ^(([A-Za-z0-9]+[-]+[A-Za-z0-9]+)+[/])$  index.php?blogurl=$1    [NC,L]
  </code></pre>
  
  <p>To my understanding, I'm saying that if the filename is part of an actual file or directory, then let it stand.  My other pages all work normally, so this seems to work.</p>
  
  <p>Then, everything else should be assumed to be part of an SEO url, and passed to index.php?blogurl=[the url].</p>
  
  <p>But that's not working.</p>
  
  <p>What stupidly obvious thing am I overlooking</p>
  
  <p>Thanks for your help!</p>