AddDefaultCharset UTF-8
#####################################################
<Files svn.info>
Order Deny,Allow
Deny from all
</Files>
<Files license.php>
Order Deny,Allow
Deny from all
</Files>
#####################################################
AddType audio/ogg .oga
AddType video/ogg .ogv .ogg
AddType video/webm .webm
AddType application/font-sfnt .otf .ttf
AddType application/vnd.ms-fontobject .eot
AddType application/font-woff .woff
AddType application/font-woff2 .woff2
#AddType font/ttf .ttf
#AddType font/eot .eot
#AddType font/woff .woff
#AddType font/woff2 .woff2
#####################################################
php_value error_reporting 0
php_value display_errors off
#php_value max_execution_time 30
#php_value memory_limit 32M
php_value date.timezone "Europe/Moscow" 
#####################################################
<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresByType application/javascript "access plus 1209600 seconds"
	ExpiresByType text/javascript "access plus 1209600 seconds"
	ExpiresByType text/css "access plus 1209600 seconds"
	ExpiresByType image/gif "access plus 1209600 seconds"
	ExpiresByType image/jpeg "access plus 1209600 seconds"
	ExpiresByType image/png "access plus 1209600 seconds"
	ExpiresByType application/font-sfnt "access plus 1209600 seconds"
	ExpiresByType application/font-vnd.ms-fontobject "access plus 1209600 seconds"
	ExpiresByType application/font-woff "access plus 1209600 seconds"
	ExpiresByType application/font-woff2 "access plus 1209600 seconds"
</IfModule>
#####################################################
##################### GZIP ##########################
<ifModule mod_gzip.c>
	mod_gzip_on Yes
	mod_gzip_dechunk Yes
	mod_gzip_item_include file .(css|js|x?html?|php|xml)$
	mod_gzip_item_include handler ^cgi-script$
	mod_gzip_item_include mime ^text/.*
	mod_gzip_item_include mime ^application/x-javascript.*
	mod_gzip_item_exclude mime ^image/.*
	mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
<IfModule mod_deflate.c>
	<FilesMatch ".(ico|css|js|x?html?|php|xml)$">
		SetOutputFilter DEFLATE
	</FilesMatch>
	AddOutputFilterByType DEFLATE application/javascript
	AddOutputFilterByType DEFLATE text/javascript
	AddOutputFilterByType DEFLATE text/css
	<IfModule mod_setenvif.c>
		BrowserMatch ^Mozilla/4 gzip-only-text/html
		BrowserMatch ^Mozilla/4\.0[678] no-gzip
		BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
	</IfModule>
</IfModule>
#####################################################
Options +FollowSymLinks
###
RewriteEngine On
###
RewriteBase /
###
#ErrorDocument 403 /403.html
#ErrorDocument 404 /404.html
###
RewriteRule .htaccess - [F]
### Acme-challenge test ###
RewriteRule ^\.well-known\/acme-challenge\/ - [L]
### 
### Dot started restrictions ###
RewriteRule ^(\.|/\.) - [R=404]
###
### Kill WWW-prefix ###
RewriteCond %{HTTP_HOST} ^www\.
RewriteCond %{HTTPS}s ^on(s)|off
RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www\.)?(.+)$
RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L]
### 
### Redirect links with index.php only ###
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{THE_REQUEST} index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [R=301,L,NC]
###
### Also cut trailing question mark ###
RewriteCond %{THE_REQUEST} ^[^\s]+\s+[^?]*?\?
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ /$1? [L,R=301]
###
### Redirect to SSL STANDART MODE ###
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
###
### Redirect to SSL NGINX MODE ###
# RewriteCond %{HTTPS} off
# RewriteCond %{HTTP:X-Forwarded-Proto} !https
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
###
### Block hacking attempts ###
### Block out any script trying to base64_encode crap to send via URL ###
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
### Block out any script that includes a <script> tag in URL ###
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%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})
### Send all blocked request to homepage with 403 Forbidden error! ###
RewriteRule ^(.*)$ index.php [F,L]
###
### Rewrite referral SEF link to simple link ###
RewriteRule ^ref_(.*)\.html$ /index.php?referral=$1 [L]
###
### Search engine ###
RewriteRule ^(search).html$ /index.php?task=$1 [L,QSA]
RewriteRule ^(search)/(any|exact|all)/(.*).html$ /index.php?task=$1&searchtype=$2&where_search=$3 [L,QSA]
###
### Check administrator urls ###
RewriteCond $1 ^(admin_folder)
RewriteCond $1 !^(admin_folder|admin_folder/|admin_folder/index\.php|admin_folder/exchange1c\.php)$
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|/[^.]*)$ [NC]
RewriteRule (.*) /index.php [R=403,L]
###
### Check if html, txt, xml file in root ###
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} (\.html|\.txt|\.xml)$
RewriteCond %{REQUEST_URI} !^(.+)/
RewriteRule ^(.*)$ $1 [L]
###
### Check if ico, gif, png, jpg, css, css.map, js file exists ###
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} (\.ico|\.gif|\.png|\.jpg|\.jpeg|\.css|\.css\.map|\.js)$
RewriteRule ^(.*)$ $1 [L]
###
### Return 404 for absent ico, gif, png, jpg, css, css.map, js file ###
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (\.ico|\.gif|\.png|\.jpg|\.jpeg|\.css|\.css\.map|\.js)$
RewriteRule . - [R=404,L,NC]
###
### Non administrator url redirect ###
### OLD ###
# RewriteCond $1 !^(admin_folder|cache|config|cron|assets|data|language|log|modules|packages|plugins|templates|tmp|widgets)
# RewriteCond $1 !^(index\.php)$
# RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|/[^.]*)$ [NC]
# RewriteRule (.*) /index.php
### NEW ###
RewriteCond $1 !^(admin_folder|assets|data|templates)
RewriteCond $1 !^(index\.php)$
RewriteRule (.*) /index.php
