If I understood you correctly, the below should work:
# match any url that does not contain "."
location ~ ^[^.]+$ {
# if the request is a filename, just issue 403 Forbidden
if (-f $request_filename) {
return 403;
}
# otherwise, it's a request to directory, so you may just want to serve index file, instead:
index index.php;
}
Andrejs