And all other files that should not be exposed from the site root folder
If you give me the ok, I'll add the same for
I guess its not a bad idea to have those blocked too. So yup :)
Apache warns against (over)use of modrewrit: https://httpd.apache.org/docs/2.4/rewrite/avoid.html
You should use RedirectMatch, for example like this:
## Begin - Security
# Block all direct access for these folders
RedirectMatch 404 (.git|tests|.AbiSuite|nbproject|.idea)
# Block access to specific file types for these system folders
RedirectMatch 404 (vendor)/(.*)\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat|dist|json|exe)
# Block all direct access to .md files:
RedirectMatch 404 \.md
# Block access to specific files in the root folder
RedirectMatch 404 (composer.lock|composer.json|\.htaccess|LICENSE)
## End - Security
It's a good suggestion, however it poses another requirement for Grav on mod_alias, which might be an issue, or not.
Most helpful comment
Apache warns against (over)use of modrewrit: https://httpd.apache.org/docs/2.4/rewrite/avoid.html
You should use RedirectMatch, for example like this:
## Begin - Security# Block all direct access for these foldersRedirectMatch 404 (.git|tests|.AbiSuite|nbproject|.idea)# Block access to specific file types for these system foldersRedirectMatch 404 (vendor)/(.*)\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat|dist|json|exe)# Block all direct access to .md files:RedirectMatch 404 \.md# Block access to specific files in the root folderRedirectMatch 404 (composer.lock|composer.json|\.htaccess|LICENSE)## End - Security