Q: Error getting value of a query string I removed all files with .php extension on my project folder using this .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)$ $1.php?%1 [NC,L,QSA]

Now, for example, home/product.php becomes home/product. 
However I have a problem, I have a url with a query string like this - "home/product_details.php?id=$id". I can only access "home/product_details". I want it to be like "home/product_details/$id". 
Please how do I do it and how can I get the value of $id?
I would usually do:
$id = $_GET['id'];

I think I need to adjust something in the .htaccess but I don't know. 
Thank you. 

A: You can use the following rules :
RewriteEngine on
#remove .php exten
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*?)/?$ $1.php [L]
#rewrite /file/foobar to /file.php?id=foobar
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/(.+)/?$ /$1.php?id=$1 [L]

