title: Query string right after base url in htaccess
body: <p>I'm currently trying to redirect every url containing query string <strong>k</strong></p>
  
  <p>Here is the desired result:</p>
  
  <p>From: <a href="http://www.example.com/?k=test" rel="nofollow">http://www.example.com/?k=test</a></p>
  
  <p>Need: <a href="http://www.example.com/" rel="nofollow">http://www.example.com/</a></p>
  
  <p>Its working well for any directories/subdirectories but not on the base url. It also seems to work on different htaccess tester online for base url but not on the server!</p>
  
  <p><strong>Here is the htaccess</strong></p>
  
  <pre><code>RewriteEngine on
  
  rewritecond %{REQUEST_FILENAME} -d [OR]
  rewritecond %{REQUEST_FILENAME} -f 
  RewriteRule (.*) - [S=12] 
  
  RewriteBase /
  RewriteCond %{QUERY_STRING} ^k=(.*)$
  RewriteRule (.*)?$ $1? [R=301,L]
  </code></pre>
  
  <p>Thank you</p>