###########################################################################
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} site.ru
RewriteRule (.*) https://site.new.ru/$1 [R=301,L]
# RewriteCond %{HTTP:PORT} !^443$
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
Options +FollowSymLinks
RewriteEngine on
# RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
# RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>
###########################################################################
#RewriteCond %{ENV:HTTPS} 1
#RewriteRule (.*) http://new.site.ru/$1 [L,R]
#RWR v
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
# RWR v20170403
RewriteEngine On
# Redirect from www ---------------------------------------------------------------------
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Config --------------------------------------------------------------------------------
RewriteCond %{HTTP_USER_AGENT} ":s:[0-9]+:" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "JDatabaseDriver" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "NT 5.1; SV1" [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP:X-FORWARDED-FOR} ":s:[0-9]+:" [NC,OR]
RewriteCond %{HTTP:X-FORWARDED-FOR} "JDatabaseDriver" [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_USER_AGENT} (MJ12Bot/v|Linkpad|Semrush) [NC]
RewriteRule .* - [F,L]
# s-0001
<IfModule autoindex_module.c>
IndexIgnore *
</IfModule>
# s-0002
ServerSignature Off
Options -Indexes
# s-0003
ErrorDocument 400 default
ErrorDocument 401 default
ErrorDocument 403 "Forbidden"
# WAF Rules -----------------------------------------------------------------------------
# Block methods
# s-0005
RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK|DEBUG) [NC]
RewriteRule .* - [F,L]
# Apache range security problem
# s-0006
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET) [NC]
RewriteCond %{HTTP:Range} ([0-9]*-[0-9]*)(\s*,\s*[0-9]*-[0-9]*)+
RewriteRule .* - [F]
# Shellshock
RewriteCond %{QUERY_STRING} (\s*)\s*{\s*:;\s*};
RewriteCond %{THE_REQUEST} (\s*)\s*{\s*:;\s*};
RewriteCond %{HTTP_REFERER} (\s*)\s*{\s*:;\s*};
RewriteCond %{HTTP_USER_AGENT} (\s*)\s*{\s*:;\s*};
RewriteRule .* - [F,L]
# Block sensitive files
# s-0015
<FilesMatch "\.(cfg|pl|htaccess|htpasswd|ini|phps|fla|psd|log|sh|sql|inc|tpl|svn|git|cvs|phtml|asp)$">
Order Allow,Deny
Deny from All
</FilesMatch>
# Block sensitive files
# s-0016
<FilesMatch "\.(cgi)$">
Order Allow,Deny
Deny from All
</FilesMatch>
# Block parasite traffic
# s-0018
RewriteCond %{HTTP_REFERER} iskalko\.ru [NC,OR]
RewriteCond %{HTTP_REFERER} buttons-for-website\.com
RewriteCond %{HTTP_REFERER} semalt.semalt\.com
RewriteCond %{HTTP_REFERER} cenoval\.ru
RewriteCond %{HTTP_REFERER} darodar\.com
RewriteCond %{HTTP_REFERER} cenokos\.ru
RewriteCond %{HTTP_REFERER} seoexperimenty\.ru
RewriteCond %{HTTP_REFERER} gobongo\.info
RewriteCond %{HTTP_REFERER} adcash\.com
RewriteCond %{HTTP_REFERER} websocial\.me
RewriteCond %{HTTP_REFERER} cityadspix\.com
RewriteCond %{HTTP_REFERER} luxup\.ru
RewriteCond %{HTTP_REFERER} superiends\.org
RewriteCond %{HTTP_REFERER} socialseet\.ru
RewriteCond %{HTTP_REFERER} screentoolkit\.com
RewriteCond %{HTTP_REFERER} cur\.lv
RewriteRule .* - [F]
###########################################################################
Options -Indexes
ErrorDocument 404 /404.php
ErrorDocument 500 /crash/index.html
ErrorDocument 502 /crash/index.html
ErrorDocument 503 /crash/index.html
ErrorDocument 504 /crash/index.html
<IfModule mod_php5.c>
php_flag allow_call_time_pass_reference 1
php_flag session.use_trans_sid off
php_value display_errors 1
php_value mbstring.internal_encoding UTF-8
php_value mbstring.func_overload 2
</IfModule>
#php_value auto_prepend_file /home/bitrix/ext_www/lor_protect/lor_o.php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/jpeg "access plus 3 day"
ExpiresByType image/gif "access plus 3 day"
</IfModule>