ErrorDocument 404 /error.php?err=404
ErrorDocument 403 /error.php?err=403

RewriteEngine On
RewriteCond %{REQUEST_URI} !\.php$ [NC]
RewriteCond %{REQUEST_URI} [^/]$
RewriteRule ^([^\.]+)$ $1.php [NC,L]

RedirectMatch 404 /\.git

options -indexes