Q:

Hide extension and variables using .htaccess

How can I hide the file's extension and the GET variables via .htaccess in one line?
This code doesn't work:
...
RewriteRule ^(.*)$ $1.php [L]
RewriteRule ^file-([0-9]+)\.php$ /some_directory/files.php?id=$1 [L]

Example:
http://www.example.com/file.php?variable=value
Should be:
http://www.example.com/file

A:

You need to add a few conditions to the first rule to keep it from looping, you can try changing it to:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]

Then go continue with your second rule, which loks fine the way it is.

