mirror of
https://github.com/myronblair/tomsjavajive
synced 2026-07-28 01:02:35 -05:00
Harden .git/config/includes/db block: RedirectMatch not honored, use mod_rewrite REQUEST_URI matching
This commit is contained in:
@@ -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]
|
||||||
|
|||||||
Reference in New Issue
Block a user