Harden .git/config/includes/db block: RedirectMatch not honored, use mod_rewrite REQUEST_URI matching

This commit is contained in:
2026-07-04 15:57:18 -05:00
parent 186ac0cb6d
commit a4ebf26a48
+10
View File
@@ -3,6 +3,16 @@
# Enable URL rewriting # Enable URL rewriting
RewriteEngine On RewriteEngine On
# Block sensitive paths outright. RedirectMatch/FilesMatch/Require/Order
# directives were confirmed NOT to be honored on this LiteSpeed setup (config/,
# includes/*.php, and .git/ were all still reachable live despite the
# RedirectMatch rules further down) — only mod_rewrite matching on REQUEST_URI
# is confirmed to actually work here. This must come before other rewrites.
RewriteCond %{REQUEST_URI} ^/(\.git|config/|includes/.*\.php|install/|db/)
RewriteRule .* - [F,L]
RewriteCond %{REQUEST_URI} \.sql$
RewriteRule .* - [F,L]
# Force HTTPS (uncomment in production) # Force HTTPS (uncomment in production)
RewriteCond %{HTTPS} off RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]