этой мой htaccess . не изменяй мои коды. измени их порядок расположения, расположи коды внутри моего htaccess так , чтобы ответ сервера (TTFB) стал самым быстрым. RewriteEngine On
RewriteBase /

# Отключение сигнатуры сервера
ServerSignature Off

# Отключение возможности просмотра директорий и следование символическим ссылкам
Options -Indexes
Options +FollowSymlinks

# Запрет внутренним подключениям Apache ломать кэш
RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
RewriteRule .* - [F,L]

<IfModule mod_headers.c>
php_flag register_globals Off
AddDefaultCharset utf-8

# Отключение ETag и установка Cache-Control на 1 год
    Header unset ETag
    Header set Cache-Control "max-age=31536000, public"

# Reduce server overhead by enabling output compression if supported.
php_flag zlib.output_compression On
php_value zlib.output_compression_level 9

# Установка Vary заголовка для поддержки сжатия gzip
    <FilesMatch ".(html|php|img|flv|gif|jpg|jpeg|png|svg|ico|swf|js|css|webp|pdf|txt|php|xml|woff2|woff|ttf|pl)$">
        Header append Vary Accept-Encoding
    </FilesMatch>

<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

# Отключение сжатия для некоторых типов файлов
   SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
</IfModule>

# Установка Connection: keep-alive
    Header set Connection keep-alive
</IfModule>

# Перенаправление с http://blm21.com и http://www.blm21.com на https://computer-master-moscow.pro
RewriteCond %{HTTP_HOST} ^(www\.)?blm21\.com [NC]
RewriteCond %{REQUEST_URI} !^/robots.*
RewriteRule (.*)$ https://computer-master-moscow.pro/$1 [R=301,L]

# Обработка запросов через index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# Удаление дублирующихся слэшей
RewriteCond %{REQUEST_URI} ^(.*?)\/{2,}(.*?)$
RewriteRule . %1/%2 [L,R=301]
RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [R=301,L]

# Удаление www из домена
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

# Перенаправление с http на https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]

# Включение сжатия
<IfModule mod_mime.c>
    AddType application/javascript .js
    AddType application/json .json
    AddType application/rss+xml .rss
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-font .x-font
    AddType application/x-font-opentype .otf
    AddType application/x-font-truetype .ttf
    AddType application/x-font-ttf .ttf
    AddType application/xhtml+xml .xhtml
    AddType application/xml .xml
    AddType font/opentype .otf
    AddType font/ttf .ttf
    AddType image/webp .webp
    AddType image/jpg .jpg
    AddType image/jpeg .jpeg
    AddType image/png .png
    AddType image/gif .gif
    AddType image/svg+xml .svg
    AddType image/x-icon .ico
    AddType text/css .css
    AddType text/html .html
    AddType text/javascript .js
    AddType text/plain .txt
    AddType text/xml .xml
</IfModule>

<IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-truetype application/x-font-ttf application/xhtml+xml application/xml font/opentype font/ttf image/svg+xml image/x-icon text/css text/html text/javascript text/plain text/xml image/webp image/jpg image/jpeg image/gif image/png
</IfModule>

# Установка длины кэширования для статических файлов
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresByType application/javascript "access plus 1 year"
    ExpiresByType application/json "access plus 1 year"
    ExpiresByType application/rss+xml "access plus 1 year"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
    ExpiresByType application/x-font "access plus 1 year"
    ExpiresByType application/x-font-opentype "access plus 1 year"
    ExpiresByType application/x-font-truetype "access plus 1 year"
    ExpiresByType application/x-font-ttf "access plus 1 year"
    ExpiresByType application/xhtml+xml "access plus 1 year"
    ExpiresByType application/xml "access plus 1 year"
    ExpiresByType application/x-gzip "access plus 1 year"
    ExpiresByType font/opentype "access plus 1 year"
    ExpiresByType font/ttf "access plus 1 year"
    ExpiresByType text/css "access plus 1 year"
    ExpiresByType text/html "access plus 1 year"
    ExpiresByType text/javascript "access plus 1 year"
    ExpiresByType text/plain "access plus 1 year"
    ExpiresByType text/xml "access plus 1 year"

    <FilesMatch ".(html|php|gz|img|flv|gif|jpg|jpeg|png|svg|ico|swf|js|css|webp|pdf|txt|xml|woff2|woff|ttf)$">
        Header set Cache-Control "max-age=2678400"
    </FilesMatch>
</IfModule>

# Ограничения доступа
<IfModule mod_authz_core.c>
    Require all granted
</IfModule>

<IfModule mod_authz_host.c>
    Require all granted
</IfModule>

# Блокировка наглых ботов
RewriteCond %{HTTP_USER_AGENT} Bytespider [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Bytespider
RewriteRule ^.*$ - [F]

<RequireAll>
    Require all granted
    Require not ip 213.159.210.11
</RequireAll>

RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since},E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match},L]

RewriteRule ^sitemap\.xml$ /google_sitemap.php [L]