-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# --- Настройка перезаписи --- | ||
# Включаем перезапись | ||
RewriteEngine On | ||
|
||
# Принудительное использование домена без "www" | ||
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | ||
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | ||
|
||
# Если запрашиваемый файл или директория не существует, перенаправляем на главную страницу | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteCond %{REQUEST_FILENAME} !-d | ||
RewriteRule ^.*$ / [L,R=301] | ||
|
||
# --- Настройки безопасности --- | ||
# Запрещаем доступ к .htaccess | ||
<Files .htaccess> | ||
Order allow,deny | ||
Deny from all | ||
</Files> | ||
|
||
# --- Настройки оптимизации --- | ||
# Включаем сжатие Gzip для текстовых файлов | ||
<IfModule mod_deflate.c> | ||
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript | ||
</IfModule> | ||
|
||
# Устанавливаем заголовки кэширования для статических ресурсов | ||
<IfModule mod_expires.c> | ||
ExpiresActive On | ||
ExpiresDefault "access plus 1 month" | ||
ExpiresByType image/jpeg "access plus 1 year" | ||
ExpiresByType image/png "access plus 1 year" | ||
</IfModule> |