-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.htaccess
More file actions
92 lines (78 loc) · 2.47 KB
/
Copy path.htaccess
File metadata and controls
92 lines (78 loc) · 2.47 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Włącz przepisywanie URL
RewriteEngine On
# Przekieruj na HTTPS (jeśli dostępne)
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Ukryj rozszerzenia .php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]
# Blokuj dostęp do wrażliwych plików
<Files "config.php">
Order allow,deny
Deny from all
</Files>
<Files "database.php">
Order allow,deny
Deny from all
</Files>
<Files "*.sql">
Order allow,deny
Deny from all
</Files>
# Blokuj dostęp do katalogów konfiguracyjnych
<Directory "config">
Order allow,deny
Deny from all
</Directory>
# Ustaw nagłówki bezpieczeństwa
<IfModule mod_headers.c>
Header always set X-Content-Type-Options nosniff
Header always set X-Frame-Options DENY
Header always set X-XSS-Protection "1; mode=block"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
</IfModule>
# Kompresja gzip
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
# Cache statycznych plików
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>
# Limit rozmiaru uploadu
php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_execution_time 300
php_value max_input_time 300
# Wyłącz wyświetlanie błędów w produkcji
# php_flag display_errors Off
# php_flag log_errors On
# Ustaw stronę błędu 404
ErrorDocument 404 /index.php
# Blokuj dostęp do ukrytych plików
<Files ".*">
Order allow,deny
Deny from all
</Files>
# Pozwól na .htaccess
<Files ".htaccess">
Order allow,deny
Allow from all
</Files>