-
Notifications
You must be signed in to change notification settings - Fork 4
/
.htaccess
61 lines (44 loc) · 1.75 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
# Kirby .htaccess
Options -Indexes
# Rewrite rules
<IfModule mod_rewrite.c>
RewriteEngine on
# Redirect legacy domain links
RewriteCond %{HTTP_HOST} !^newtonglossary.com$ [NC]
# RewriteRule ^(.*)$ https://newtonglossary.com/$1 [L,R=301]
# Forced SSL
# RewriteCond %{HTTPS} !=on
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# Block files and folders beginning with a dot, such as .git
# Except for the .well-known folder, which is used for Let’s Encrypt and security.txt
RewriteRule (^|/)\.(?!well-known\/) index.php [L]
# Block all files in the content folder from being accessed directly
RewriteRule ^content/(.*) index.php [L]
# Block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) index.php [L]
# Block direct access to Kirby and the Panel sources
RewriteRule ^kirby/(.*) index.php [L]
# Make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
</IfModule>
# Pass the Authorization header to PHP
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
# Compress text file responses
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
# Set security headers in all responses
<IfModule mod_headers.c>
# Serve files as plain text if the actual content type is not known
# Hardens against attacks from malicious file uploads
Header set Content-Type "text/plain" "expr=-z %{CONTENT_TYPE}"
Header set X-Content-Type-Options "nosniff"
</IfModule>