DirectoryIndex index.php
AddDefaultCharset utf-8

# Если NetCat стоит в подпапке, например mysite, то
# ErrorDocument 404 /mysite/netcat/require/e404.php
# в противном случае
ErrorDocument 404 /netcat/require/e404.php

Options -Indexes
Options +FollowSymLinks

<IfModule mod_php5.c>
php_flag magic_quotes_gpc off
php_flag display_errors off
php_value error_reporting 0
php_value arg_separator.output "&amp;"
php_value mbstring.internal_encoding UTF-8
php_value short_open_tag on

php_value memory_limit 250M
php_value post_max_size 192M
php_value upload_max_filesize 192M
</IfModule>

<IfModule mod_php7.c>
php_flag magic_quotes_gpc off
php_flag display_errors off
php_value error_reporting 0
php_value arg_separator.output "&amp;"
php_value mbstring.internal_encoding UTF-8
php_value short_open_tag on

php_value memory_limit 250M
php_value post_max_size 192M
php_value upload_max_filesize 192M
</IfModule>

<ifModule mod_rewrite.c>
RewriteEngine On

# ymarket
RewriteCond %{REQUEST_URI} ^/ymarket.yml$
RewriteRule ^(.+)$ /yandex_market/init.php [L]

# Наш sitemap.xml, а не netcat
RewriteCond %{REQUEST_URI} ^/sitemap.xml$
RewriteRule ^(.+)$ /sitemap/sitemap.php [L]

#Ватемарк с текстом
#RewriteRule ^_/(.+)$ /watermark_nocopy_text.php?REQUEST_URI=$1 [L]

#Ватемарк с повторяющимся текстом
RewriteRule ^_/(.+)$ /watermark_nocopy_text_repeat.php?REQUEST_URI=$1 [L]

#Ватемарк с рисунком
#RewriteRule ^_/(.+)$ /watermark_nocopy.php?REQUEST_URI=$1 [L]

#301 редирект с www на БЕЗ www
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]

#301 редирект без www НА www
#RewriteCond %{HTTP_HOST} ^([^www].*)$
#RewriteRule ^(.*)$ http://www.%1/$1 [L,R=301]

# редирект с http на https (один из вариантов)
#RewriteCond %{HTTPS} off
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#301 редирект c /index/ на /
RewriteCond %{REQUEST_URI} ^/index/$
RewriteRule ^.*$ / [R=301,L]

#301 редирект с index.php, index.html или index.htm на /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html|htm)\ HTTP/
RewriteRule ^(.*)index\.(php|html|htm)$ / [R=301,L]

#301 редирект с index.html/ на /
RewriteCond %{REQUEST_URI} ^/index.html/$
RewriteRule ^.*$ / [R=301,L]

#301 редирект с index.htm/ на /
RewriteCond %{REQUEST_URI} ^/index.htm/$
RewriteRule ^.*$ / [R=301,L]

#301 редирект с index.php/ на /
RewriteCond %{REQUEST_URI} ^/index.php/$
RewriteRule ^.*$ / [R=301,L]

#301 редирект с /home/  на /
RewriteCond %{REQUEST_URI} ^/home/$
RewriteRule ^.*$ / [R=301,L]

#301 редирект со страниц без слеша на слеш (весь сайт)
#  с этим редиректом не работат компонент "иконка" и "изображение"! Без этой записи на большинстве страниц и так происходит редирект, но не на всех
RewriteCond %{REQUEST_URI} !\?
RewriteCond %{REQUEST_URI} !\&
RewriteCond %{REQUEST_URI} !\=
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_URI} !\/$
RewriteRule ^(.*[^\/])$ /$1/ [R=301,L]

#301 редирект c // на / (весь сайт)
RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [R=301,L]

#301 редиректы со одной страницы на другую: НАЧАЛО

#301 редиректы со одной страницы на другую: КОНЕЦ

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

# Если NetCat стоит в подпапке, например mysite, то
# RewriteRule ^(.+)$ /mysite/netcat/require/e404.php
# в противном случае
RewriteRule ^(.+)$ /netcat/require/e404.php
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]
</ifModule>

# Кеширование
<ifModule mod_expires.c>

# Add correct content-type for fonts & SVG
AddType application/font-woff2 .woff2
AddType image/svg+xml .svg

ExpiresActive On
# Кэширование по умолчанию 0 секунд
ExpiresDefault "access plus 0 seconds"

# Cache Images
ExpiresByType image/x-icon "access plus 97 days"
ExpiresByType image/jpg "access plus 97 days"
ExpiresByType image/jpeg "access plus 97 days"
ExpiresByType image/png "access plus 97 days"
ExpiresByType image/gif "access plus 97 days"
ExpiresByType image/svg+xml "access plus 97 days"
ExpiresByType image/webp "access plus 97 days"

# Cache audio, video
ExpiresByType video/ogg "access plus 97 days"
ExpiresByType audio/ogg "access plus 97 days"
ExpiresByType video/mp4 "access plus 97 days"
ExpiresByType video/webm "access plus 97 days"

# Cache fonts
ExpiresByType application/x-font-woff "access plus 97 days"
ExpiresByType application/font-woff2 "access plus 97 days"
ExpiresByType application/x-font-ttf "access plus 97 days"
ExpiresByType font/opentype "access plus 97 days"
ExpiresByType application/vnd.ms-fontobject "access plus 97 days"

# Cache css, js
ExpiresByType text/css "access plus 97 days"
ExpiresByType text/javascript "access plus 97 days"
ExpiresByType application/javascript "access plus 97 days"
ExpiresByType application/x-javascript "access plus 97 days"

</ifModule>
# /Кеширование

# Сжатие
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript application/font-woff2 image/svg+xml application/json application/xml+rss
</ifModule>
# /Сжатие