title: php router - variable url
body: <p>Hello I was trying to come up with the solution to my problem, but I just was not able to. So here is my problem:</p>
  
  <p>What I used was a .htaccess</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule  ^.+(.*)/(.*)$   ./index.php?mesto=$1&amp;den=$2 [QSA,NC,L]
  </code></pre>
  
  <p>It will display the url well. as <code>www.site.com/CITY/DAY</code> for example ../Prague/30.3.2014 but i need it to be more complex.</p>
  
  <p>What I need is to have additional parameters, such as Bar or Restaurant in the url for example <code>www-site.com/Prague/30.3.2014/p/bar/restaurant</code> and other time I might have <code>www-site.com/Prague/30.3.2014/p/pizza/bar</code></p>
  
  <p>That part I have no idea how to do, because I have 5 different parameters</p>
  
  <p>I imagine that the raw url would look this <code>index.php?city=Prague&amp;day=30.3.2014&amp;p1=0&amp;p2=0&amp;p3=0&amp;p4=0&amp;p5=0</code> where p1 to p5 are the parameters being active (0 not 1 yes).</p>
  
  <p>I don't understand how to detect what parameters are active and how to properly display the pretty url. Could you please help me?</p>