title: Implementing Mod Rewrite in Dynamic PHP website
body: <p>I have built a website in PHP that takes cars from a csv file, imports them by cron into the database. The cars are displayed in a file which is <b>showroom.php</b> by <b>?id=slugname-from-database-row</b>, the slug is created on import, however I do lack the knowledge to get the rewriting to work as it seems to conflict with <b>news_content.php?id=slugname-from-database-row</b> which displays the latest news and works the exact same way as showroom.php.</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  Options +FollowSymLinks
  Options -Multiviews 
  RewriteEngine On
  RewriteCond %{SCRIPT_FILENAME} !-d  
  RewriteCond %{SCRIPT_FILENAME} !-f
  #RewriteRule ^([^/]+)/?$ news_content.php?id=$1 [L]
  RewriteRule ^([^/]+)/?$ showroom.php?id=$1 [L]
  &lt;IfModule&gt;
  </code></pre>
  
  <p>Only page or the other works, if I comment out the above line like so in <b>.htaccess</b> the re-writing works fine on showroom.php:</p>
  
  <pre><code>http://127.0.0.1/showroom.php?id=604010047-honda-cr-z-3-door-15-ima-sport-hybrid-manual
  </code></pre>
  
  <p>gets rewritten to:</p>
  
  <pre><code>http://127.0.0.1/604010047-honda-cr-z-3-door-15-ima-sport-hybrid-manual
  </code></pre>
  
  <p>If uncomment out the above line relating to news_content.php in .htaccess the showroom.php page does not work or vice versa!</p>
  
  <p>The news page works like this as above:</p>
  
  <pre><code>http://127.0.0.1/news_content.php?id=test-slug-news-item-from-database 
  </code></pre>
  
  <p>gets rewritten to:</p>
  
  <pre><code>http://127.0.0.1/test-slug-news-item-from-database
  </code></pre>
  
  <p>Its driving me mad! Any help much appreciated!</p>