mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Several hatches improvements and unifications
This commit is contained in:
parent
9bd62558c1
commit
7202766cb5
55
.htaccess
55
.htaccess
|
|
@ -2,7 +2,24 @@
|
|||
|
||||
RewriteEngine On
|
||||
|
||||
##
|
||||
## Begin - Exploits
|
||||
# If you experience problems on your site block out the operations listed below
|
||||
# This attempts to block the most common type of exploit `attempts` to Grav
|
||||
#
|
||||
# Block out any script trying to base64_encode data within the URL.
|
||||
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
|
||||
# Block out any script that includes a <script> tag in URL.
|
||||
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
|
||||
# Block out any script trying to set a PHP GLOBALS variable via URL.
|
||||
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
|
||||
# Block out any script trying to modify a _REQUEST variable via URL.
|
||||
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
|
||||
# Return 403 Forbidden header and show the content of the root homepage
|
||||
RewriteRule .* index.php [F]
|
||||
#
|
||||
## End - Exploits
|
||||
|
||||
## Begin RewriteBase
|
||||
# If you are getting 404 errors on subpages, you may have to uncomment the RewriteBase entry
|
||||
# You should change the '/' to your appropriate subfolder. For example if you have
|
||||
# your Grav install at the root of your site '/' should work, else it might be something
|
||||
|
|
@ -11,29 +28,29 @@ RewriteEngine On
|
|||
|
||||
# RewriteBase /
|
||||
|
||||
# access site
|
||||
## End - RewriteBase
|
||||
|
||||
## Begin - Index
|
||||
# If the requested path and file is not /index.php and the request
|
||||
# has not already been internally rewritten to the index.php script
|
||||
RewriteCond %{REQUEST_URI} !^/index\.php
|
||||
# and the requested path and file doesn't directly match a physical file
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
# and the requested path and file doesn't directly match a physical folder
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
# internally rewrite the request to the index.php script
|
||||
RewriteRule .* index.php [L]
|
||||
## End - Index
|
||||
|
||||
# block various user files from being accessed directly
|
||||
RewriteRule ^user/accounts/(.*)$ error [L]
|
||||
RewriteRule ^user/config/(.*)$ error [L]
|
||||
RewriteRule ^user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ error [L]
|
||||
|
||||
# block cache
|
||||
RewriteRule ^cache/(.*) error [L]
|
||||
|
||||
# block bin
|
||||
RewriteRule ^bin/(.*)$ error [L]
|
||||
|
||||
# block system
|
||||
RewriteRule ^system/(.*)\.(txt|md|html|php|sh|bat|yaml)$ error [L]
|
||||
|
||||
# block vendor (non CSS/JS)
|
||||
RewriteRule ^vendor/(.*)\.(txt|md|html|php|sh|bat|yaml)$ error [L]
|
||||
## Begin - Security
|
||||
# Block all direct access for these folders
|
||||
RewriteRule ^(cache|bin|logs)/(.*) error [L]
|
||||
# Block access to specific file types for these folders
|
||||
RewriteRule ^(system|user|vendor)/(.*)\.(txt|md|html|yaml|php|twig|sh|bat)$ error [L]
|
||||
## End - Security
|
||||
|
||||
</IfModule>
|
||||
|
||||
# Prevent file browsing
|
||||
# Begin - Prevent Browsing
|
||||
Options -Indexes
|
||||
# End - Prevent Browsing
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user