Fancy URL (remove .php extension)

I have a haproxy server and everything is working. But i just need to remove the extension from the url like that:


Before it was working over .htaccess with this code:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]

But since i proxy through haproxy it doesnt work anymore

Any help appreciated.