This is my .htaccess file, everything works so far but I can't manage to remove .php extension from files, every code that I tried from other answers just threw 500 or 404 error. Please advise where and what to add. Structure of the folders is localhost/myfolder/somefile.php
Just to be clear - localhost/myfolder/ is a root for my project.
RewriteEngine On     
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /myfolder/$1/ [L,R=301]
RewriteRule     ^team-news/([0-9]+[/])?$    posts.php?p=$1&cat=Team\ News
RewriteRule     ^product-news/([0-9]+[/])?$    posts.php?   p=$1&cat=Product\ News
RewriteRule     ^member-specials/([0-9]+[/])?$    posts.php?p=$1&cat=Member\ Specials
RewriteRule     ^ambassador-blogs/([0-9]+[/])?$    posts.php?p=$1&cat=Ambassador\ Blogs
RewriteRule     ^user/([0-9]+[/])?$         profile.php?id=$1
RewriteRule     ^browse-all/([0-9]+[/])?$   searchall.php?p=$1
RewriteRule     ^edit/([0-9]+[/])?$         edit.php?id=$1
RewriteRule     ^articles/([0-9]+[/])?$     post.php?id=$1