-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.htaccess
More file actions
33 lines (28 loc) · 1.46 KB
/
.htaccess
File metadata and controls
33 lines (28 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<IfModule mod_rewrite.c>
RewriteEngine On
# Прямая отдача существующих файлов из cache/ (ускорение)
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^cache/ - [L]
# Все запросы к изображениям (кроме папки кеша) — через index.php.
# Правило работает относительно текущей директории файла .htaccess
RewriteCond $1 !^cache/
RewriteRule ^(.*)\.(jpg|jpeg|png|gif|webp|avif|svg)$ index.php?name=$1.$2 [L,QSA,NC]
</IfModule>
# ============================================================
# Безопасность: блокировка прямого доступа к PHP-скриптам
# кроме index.php (точки входа)
# ============================================================
<FilesMatch "^(download_composer|resize_class)\.php$">
Order deny,allow
Deny from all
</FilesMatch>
# ============================================================
# SEC-07: SVG в cache/ — Content-Security-Policy чтобы запретить
# скрипты в SVG-файлах при прямом доступе браузера
# ============================================================
<IfModule mod_headers.c>
<FilesMatch "\.svg$">
Header set Content-Security-Policy "default-src 'none'; style-src 'unsafe-inline'"
Header set X-Content-Type-Options "nosniff"
</FilesMatch>
</IfModule>