title: get current url and pass part of it as variable
body: <p>I need to write optimized .htaccess rules. I had written like that and they are working</p>
  <pre><code>RewriteEngine on
  RewriteRule ^city1-name-in-url/$ products.php?city=city1-name-in-url
  RewriteRule ^city2-name-in-url/$ products.php?city=city2-name-in-url
  RewriteRule ^city3-name-in-url/$ products.php?city=city3-name-in-url
  RewriteRule ^city4-name-in-url/$ products.php?city=city4-name-in-url
  </code></pre>
  <p>And url for these rules are <code>http://www.example.com/global/city1-name-in-url/</code></p>
  <p>I have to write these rules for 800 cities which is making website slow. I want to know if there is anyway to get the part url and use it in <code>RewriteRule</code></p>
  <p>Example like</p>
  <p>If url : <code>http://www.example.com/global/any-city-name/</code></p>
  <p><code>RewriteRule ^any-city-name/$ products.php?city=any-city-name</code></p>
  <p>This is possible? To get the part of url after <code>global</code> and then use it in rewrite rule.</p>