Apache(.htaccess):
RewriteEngine On
RewriteBase /
RewriteRule ^()$ index.php [NC,L]
Rewritecond %{REQUEST_URI} !(^/?.*..*$) [NC]
RewriteRule (.*)$ $1.php [NC]
nginx:
location / {
root /htdocs/;
index index.php index.html index.htm;
rewrite ^/()$ /index.php last;
rewrite /(.*)$ /$1.php;
}