-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.htaccess
104 lines (87 loc) · 2.49 KB
/
.htaccess
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
93
94
95
96
97
98
99
100
101
102
103
104
# .htaccess for WordPress Plugins Overview
# DOMAIN AND SUBDOMAIN REWRITE
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !127.0.0.1
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
# SET MIME TYPES according to file extension
<IfModule mod_mime.c>
AddType application/json .json
AddType text/css .css
AddType text/csv .csv
AddType text/html .html .htm .php
AddType text/javascript .js
</IfModule>
# SET EXPIRES HEADERS
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 week"
# CSS and Javascript
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
# HTML documents, Feeds
ExpiresByType text/html "access plus 0 seconds"
# Data
ExpiresByType application/json "access plus 2 seconds"
</IfModule>
# SET HEADERS FOR CACHING / SECURITY
<IfModule mod_headers.c>
# SET HEADERS FOR CACHING
Header always unset ETag
FileETag None
Header append Vary Accept-Encoding
Header always unset Cache-Control
Header merge Cache-Control "public, must-revalidate, proxy-revalidate"
# SET HEADERS FOR SECURITY
Header set Strict-Transport-Security "max-age=63072000; preload"
Header set X-Content-Type-Options "nosniff"
Header set X-Frame-Options "deny"
Header set X-XSS-Protection "1; mode=block"
Header set Content-Security-Policy "default-src 'self'"
Header set Permissions-Policy "geolocation=()"
Header set Referrer-Policy same-origin
# Remove server information
Header set Server ""
Header always unset Server
# Remove PHP version etc.
Header set X-Powered-By ""
Header always unset X-Powered-By
</IfModule>
# ENABLE GZIP COMPRESSION
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>
# DISABLE THE SERVER SIGNATURE
ServerSignature Off
# DISALLOW ACCESS TO PRIVATE FILES
<files config.php>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</files>
<files config.sample.php>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</files>
<files functions.php>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</files>