diff --git a/.htaccess b/.htaccess
index 8f13d0509754f5938aac0eaeb1a1ce2fc621a91a..87feb31fd88c85fbab827289e2cf9d2be2aa908f 100644
--- a/.htaccess
+++ b/.htaccess
@@ -65,8 +65,8 @@
   RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
   RewriteRule ^remote/(.*) remote.php [QSA,L]
   RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
-  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
-  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
+  RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
+  RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
 </IfModule>
 <IfModule mod_mime.c>
   AddType image/svg+xml svg svgz