mirror of
https://github.com/flextype/flextype.git
synced 2025-08-05 04:37:43 +02:00
Updates for .htaccess #2
This commit is contained in:
104
.htaccess
104
.htaccess
@@ -1,63 +1,71 @@
|
||||
#
|
||||
##
|
||||
# This file is part of the Rawilum.
|
||||
#
|
||||
# (c) Romanenko Sergey / Awilum <awilum@msn.com>
|
||||
#
|
||||
# For the full copyright and license information, please view the LICENSE
|
||||
# file that was distributed with this source code.
|
||||
#
|
||||
|
||||
# Set default charset utf-8
|
||||
AddDefaultCharset UTF-8
|
||||
|
||||
# PHP 5, Apache 1 and 2.
|
||||
<IfModule mod_php5.c>
|
||||
php_flag magic_quotes_gpc off
|
||||
php_flag magic_quotes_sybase off
|
||||
php_flag register_globals off
|
||||
</IfModule>
|
||||
##
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
|
||||
## Begin - Rewrite rules to block out some common 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 Rawilum
|
||||
#
|
||||
# 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 - Rewrite rules to block out some common exploits.
|
||||
RewriteEngine On
|
||||
|
||||
## Begin - Rewrite rules for Rawilum
|
||||
RewriteBase /rawilum/
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php [QSA,L]
|
||||
## End - Rewrite rules for Rawilum
|
||||
RewriteBase /rawilum/
|
||||
|
||||
## Begin - Rewrite rules for SEO improvements.
|
||||
# RewriteCond %{HTTP_HOST} ^www.example.org [NC]
|
||||
# RewriteRule ^(.*)$ http://example.org/$1 [R=301,L]
|
||||
# Redirect 301 /index http://example.org/
|
||||
## End - Rewrite rules for SEO improvements.
|
||||
## 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 Rawilum
|
||||
#
|
||||
# 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 - 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
|
||||
|
||||
## Begin - Security
|
||||
# Block all direct access for these folders
|
||||
RewriteRule ^(\.git|rawilum)/(.*) error [F]
|
||||
# Block access to specific file types for these system folders
|
||||
RewriteRule ^(rawilum|vendor)/(.*)\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|sh|bat)$ error [F]
|
||||
# Block access to specific file types for these user folders
|
||||
RewriteRule ^(site)/(.*)\.(txt|md|yaml|yml|php|pl|py|cgi|sh|bat)$ error [F]
|
||||
# Block all direct access to .md files:
|
||||
RewriteRule \.md$ error [F]
|
||||
# Block all direct access to files and folders beginning with a dot
|
||||
RewriteRule (^|/)\.(?!well-known) - [F]
|
||||
# Block access to specific files in the root folder
|
||||
RewriteRule ^(LICENSE\.md|composer\.lock|composer\.json|\.htaccess)$ error [F]
|
||||
## End - Security
|
||||
|
||||
## Begin - Rewrite rules for SEO improvements.
|
||||
# RewriteCond %{HTTP_HOST} ^www.example.org [NC]
|
||||
# RewriteRule ^(.*)$ http://example.org/$1 [R=301,L]
|
||||
# Redirect 301 /index http://example.org/
|
||||
## End - Rewrite rules for SEO improvements.
|
||||
|
||||
</IfModule>
|
||||
|
||||
# Prevent visitors from viewing files directly.
|
||||
<FilesMatch "(^#.*#|\.(md|txt|html|tpl|yml|yaml)|~)$">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
Satisfy All
|
||||
</FilesMatch>
|
||||
|
||||
# Don't show directory listings for URLs which map to a directory.
|
||||
## Begin - Prevent Browsing and Set Default Resources
|
||||
Options -Indexes
|
||||
DirectoryIndex index.php index.html index.htm
|
||||
## End - Prevent Browsing and Set Default Resources
|
||||
|
Reference in New Issue
Block a user