Skip to content

Instantly share code, notes, and snippets.

@lynt-smitka
Last active August 12, 2024 09:18
Show Gist options
  • Save lynt-smitka/1ce5c4bb3a8d251df0b3268019787664 to your computer and use it in GitHub Desktop.
Save lynt-smitka/1ce5c4bb3a8d251df0b3268019787664 to your computer and use it in GitHub Desktop.
Block hidden files except .well-known - Apache .htaccess + Nginx
RewriteRule "(^|/)\.(?!well-known\/)" - [F]
location ~ /\.(?!well-known\/) {
deny all;
}
<Directory ~ "/\.(?!well-known\/)">
Order deny,allow
Deny from all
</Directory>
<Directory ~ "/\.(?!well-known\/)">
Require all denied
</Directory>
status 403 /blockdot
rewrite {
r /\.(?!well-known\/)
to /blockdot
}
@Rohlik
Copy link

Rohlik commented Aug 6, 2023

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment