title: How to rewrite URL paths to query strings
body: <p>Here is my .htaccess file:</p>
  
  <pre><code># To remove trailing slash
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} /(.*)/$
  RewriteRule ^ /%1 [R=301,L]
  
  # To remove .php extension
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ (.*)\.php [NC]
  RewriteRule ^ %1 [R=301,L]
  
  # To check whether the PHP file exists and set it back internally
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^.*$ $0.php [L]
  
  # To redirect /index to root
  RewriteCond %{THE_REQUEST} ^.*/index
  RewriteRule ^(.*)index.php$ /$1 [R=301,L]
  </code></pre>
  
  <p>Assume there is a file.php in the root directory and v1,v2,... are my query string inputs and the URL below is requested:</p>
  
  <pre><code>http://domain.tld/file/v1/v2...
  </code></pre>
  
  <p>I simply need to send v1,v2,... as HTTP GET to the file.php using .htaccess and it should work with any other PHP file names and in case of possibility any number of inputs, otherwise handling up to 3 inputs is enough.</p>