title: Remove first variable from query string via htaccess
body: <p>I have used the following code for rewriting my this url:</p>
  
  <p><a href="http://example.com/foldername/New-York-Mills.php?ff_nm_from=new+york&amp;search=hotel&amp;location=north+park" rel="nofollow">http://example.com/foldername/New-York-Mills.php?ff_nm_from=new+york&amp;search=hotel&amp;location=north+park</a></p>
  
  <p>to replace query string with '/' so it's <a href="http://example.com/foldername/sa/new+york/hotel/north+park" rel="nofollow">http://example.com/foldername/sa/new+york/hotel/north+park</a>?</p>
  
  <p>I have achieved that with the following htaccess code.</p>
  
  <pre><code>RewriteCond %{THE_REQUEST} \ /+foldername/New-York-Mills\.php\?ff_nm_from=([^&amp;]+)&amp;search=([^&amp;\ ]+)&amp;location=([^&amp;\ ]+)
  RewriteRule ^ /foldername/sa/%1/%2/%3? [L,R=301]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^foldername/sa/([^/]+)/([^/]+)/([^/]+)$ /Just-dial/New-York-Mills.php?ff_nm_from=$1&amp;search=$2&amp;location=$3 [L]
  
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /style.css [NC]
  RedirectMatch 301 ^/(.*)\%2[Cc](.*)$ /$1$2?
  
  RewriteRule ^foldername/sa/(.+)/(.+)/(.+)/(.+)/? foldername/sa/$1.php?ff_nm_from=$2&amp;search=$3&amp;location=$4
  </code></pre>
  
  <p>But I want my url like the following url. This means I want to remove first variable from url after query string.
  <a href="http://example.com/foldername/New-York-Mills/hotel/north+park" rel="nofollow">http://example.com/foldername/New-York-Mills/hotel/north+park</a></p>
  
  <p>How can it be done using the .htaccess file?</p>