title: .htaccess Rewrite URL same page
body: <p><strong>I want to rewrite the following URLs:</strong></p>
  
  <pre><code>localhost/beta/coupons.php?cat=promotions point to ---&gt; localhost/beta/coupons/promotions
  
  
  localhost/beta/coupons.php?city=ny point to ---&gt; localhost/beta/coupons/ny
  </code></pre>
  
  <p>I run this code in .htaccess</p>
  
  <pre><code>    &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine on
  RewriteBase  /beta/
  
  
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule ^coupons/([^/]*)$ coupons.php?cat=$1 [L]
  
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule ^coupons/([^/]*)$ coupons.php?city=$1 [L]
  
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^coupons/([^/]+)/([^/]+)?$ coupons.php?cat=$1&amp;city=$2 [L]
  
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>The code only runs the first re writing, the second does not work.</p>
  
  <p>Thank you very much for your time.</p>