DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

.htaccess Rule To Block Access To Backed-up Files

  • submit to reddit
        If you use vi to edit files, it leaves your backup copies with tildes at the end.  Adding this to your .htaccess file (or virtual host directive in your apache conf) stops people being able to access them.

(Requires mod_rewrite)

RewriteEngine on
RewriteRule  ~$   - [F]