I want to block access to \"sub/folder/index.php\", but not \"index.php\" anywhere else.
Order allow,deny
Deny from all
How about creating a .htaccess
file in the specific folder containing the files you want to protect?
Edit:
Be careful, this actually does not work in a simple .htaccess
file, see comments below. This will only work in an apache.conf file.
This should to the trick for you without another .htaccess
file:
Order allow,deny
Deny from all