diff --git a/.htaccess-dist b/.htaccess-dist
index 3c90982515..404137168a 100644
--- a/.htaccess-dist
+++ b/.htaccess-dist
@@ -6,6 +6,7 @@ AddType application/x-java-archive .jar
 AddType audio/ogg .oga
 #AddHandler php53-cgi .php
 
+# deny access to log files (friendica.log or php.out)
 <FilesMatch "\.(out|log)$">
   <IfModule authz_host_module>
     #Apache 2.4
@@ -17,6 +18,18 @@ AddType audio/ogg .oga
   </IfModule>
 </FilesMatch>
 
+# deny access to backup files
+<FilesMatch "(\~|\.bak|\.swp)$">
+  <IfModule authz_host_module>
+    #Apache 2.4
+    Require all denied
+  </IfModule>
+  <IfModule !authz_host_module>
+    #Apache 2.2
+    Deny from all
+  </IfModule>
+</FilesMatch>
+
 <IfModule mod_rewrite.c>
   RewriteEngine on
   # Protect repository directory from browsing