title: htaccess remove .php and keep query string issue
body: <p>I have an endpoint here:</p>
  
  <pre><code>https://example.com/api/apitest/api-getinfo.php
  </code></pre>
  
  <p>Here is my htaccess file:</p>
  
  <pre><code>RewriteEngine On
  
  RewriteRule ^api/apitest/getinfo/(.*)$ /api/apitest/api-getinfo.php?name=$1&amp;%{QUERY_STRING}
  
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^/]+)/$ $1.php
  RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
  RewriteRule (.*)$ /$1/ [R=301,L]
  ErrorDocument 404 /not-found.php
  
  RewriteEngine On
  RewriteBase /
  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
  
  &lt;filesMatch "\.( jpg|jpeg|gif|png|ico|js)$"&gt;
  Header set Cache-Control "max-age=2419200, public, must-revalidate"
  &lt;/filesMatch&gt;
  </code></pre>
  
  <p>I don't really understand rewrites but this is what I've wanted:</p>
  
  <pre><code>https://example.com/api/apitest/getinfo/John
  </code></pre>
  
  <p>It's working but the URL rewrite ends up looking like this:</p>
  
  <pre><code>https://example.com//api/apitest/api-getinfo.php/John/?name=John
  </code></pre>
  
  <p>I have a feeling I'm missing something here but I'm stumped!</p>