title: (htaccess) Pagination, if the npage parameter is equal to 1 redirect to relative base url
body: <p>I have 3 parameters in URL:</p>
  
  <ol>
  <li>?lang</li>
  <li>&amp;page</li>
  <li>&amp;npage</li>
  </ol>
  
  <p>If the third parameter, npage, has the value 1, i need to redirect to relative base URL.</p>
  
  <p>From URL</p>
  
  <pre><code>\en\news\npage-1\
  </code></pre>
  
  <p>I want to redirect to</p>
  
  <pre><code>\en\news\
  </code></pre>
  
  <p>My htaccess code is this:</p>
  
  <pre><code>RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]
  
  # first parameter (lang)
  RewriteRule ^([^/]+)/$ index.php?lang=$1 [L,QSA]
  
  # second parameter (page)
  RewriteRule ^([^/]+)/([^/]+)/$ index.php?lang=$1&amp;page=$2 [L,QSA]
  
  # third parameter (npage) with pagination
  RewriteRule ^([^/]+)/([^/]+)/npage-(\d+)/$ index.php?lang=$1&amp;page=$2&amp;npage=$3 [L,QSA]
  
  # if first page, redirect to relative base url
  RewriteCond %{QUERY_STRING} (^|&amp;)npage=1(&amp;|$) [NC]
  RewriteRule ^ %{REQUEST_URI}? [R=301,L]
  </code></pre>