I had a problem where a file on a webserver was locally edited with a command line editor.
The editor created a backup file suffixed with the ~ character.
So there was a file named file.php~
This file could be directly downloaded over the webserver, because it was not processed as a php file.
I thought about a directive like this:
<Files ~ "~$">
Order allow,deny
Deny from all
</Files>
so every file that ends with ~ is denied for delivery.
Is this a good method, did I miss something?
That should adequately solve it; however, the bigger problem is in editing directly on the server, when you should be using source control (such svn, git) and then deploying from the source control. What if another editor uses
.bak?