location ~ ^/sites/[^/]+/files/.*\.php$ { deny all; error_page 404 /index.php; return 404; } location ~ \..*/.*\.php$ { error_page 404 /index.php ; return 404; } как-то так Posted at Nginx Forum: https://forum.nginx.org/read.php?21,279975,279976#msg-279976