This is why Dokuwiki has the following sequence in its .htaccess file to completely deny access to certain files:
Order allow,deny
Deny from all
Satisfy All
In .htaccess:
RewriteRule \.php$ - [F]
RewriteCond %{DOCUMENT_ROOT}/$0.php -f
RewriteRule .* $0.php [L]
At the beginning of the ruleset in .htaccess:
RewriteCond %{ENV:REDIRECT_STATUS} .
RewriteRule ^ - [L]