how to remove .php from a certain file (with apache .htaccess)

Posted by user2015253 on Stack Overflow See other posts from Stack Overflow or by user2015253
Published on 2013-06-30T22:18:21Z Indexed on 2013/06/30 22:20 UTC
Read the original article Hit count: 230

Filed under:
|

I want a certain file (only this!) to remove the php extension for calling it. BUT: It uses get parameters and they should remain!

I tried it with my .htaccess and something like: RewriteEngine on followed by either RewriteRule ^file(.*)$ file.php$1 or RewriteRule ^file(.+)$ file.php$1

but it doesn't work. (First gives error 500, second gives 404)

Example what I want to call in the browser: file?param=asd&foo=bar - It should call as: file.php?param=asd&foo=bar

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about seo