-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.htaccess
122 lines (78 loc) · 3.45 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
105
106
# Kirby .htaccess
# Boost the memory limit to ensure image thumbnails are always generated
# php_value memory_limit 256M
# Only works with mod_php, breaks with mpm_event
# Prevent directory browsing
Options -Indexes
# rewrite rules
<IfModule mod_rewrite.c>
# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on
# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
# RewriteBase /mysite
# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]
# block direct access to everything within site folder, except for assets
# http://stackoverflow.com/questions/6942652/all-except-one-directory-in-mod-rewrite
# RewriteRule ^site/(.*) index.php [L]
# RewriteCond %{REQUEST_URI} !^/assets(/|$)
# RewriteRule ^([\w/]*)$ index.php [L]
# block all files in the accounts folder from being accessed directly
# RewriteRule ^accounts/(.*) index.php [L]
# block all files in the kirby folder from being accessed directly
RewriteRule ^kirby/(.*) index.php [L]
# kirby cachebuster for css and js
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.(\d+)\.(js|css)$ $1.$3 [L]
# remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
# redirect www to non-www https
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# force https
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
<IfModule mod_headers.c>
Header set Content-Security-Policy: "default-src 'none'; style-src 'self' 'unsafe-inline' checkout.stripe.com; font-src 'self' themes.googleusercontent.com; img-src * data:; media-src *; object-src 'self'; script-src 'self' www.google-analytics.com ajax.googleapis.com checkout.stripe.com js.stripe.com disqus.com *.disqus.com *.disquscdn.com data:; child-src https://player.vimeo.com https://www.youtube.com https://acorn.blog checkout.stripe.com js.stripe.com; connect-src 'self' checkout.stripe.com; frame-src https://disqus.com *.youtube.com *.vimeo.com"
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains"
Header set X-Content-Type-Options: nosniff
# Only send a shortened referrer to foreign sites
Header set Referrer-Policy: "no-referrer, strict-origin-when-cross-origin"
# Block site from being framed with X-Frame-Options and CSP
# For IE/Edge, superceded by CSS frame-ancestors
Header set X-Frame-Options DENY
# Prevent reflected XSS attacks
# For old browsers, deprecated by CSP unsafe-inline
Header set X-XSS-Protection "1; mode=block"
<filesMatch ".(jpe?g|png|gif|ico|svg)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>
# One month for css and js
<filesMatch ".(css|js)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>
</IfModule>
</IfModule>
# Additional recommended values
# Remove comments for those you want to use.
#
AddDefaultCharset UTF-8
#
# php_flag short_open_tag on
# Increase max amount of data that can be sent via a POST in a form
# php_value post_max_size 100M
# Only works with mod_php, breaks with mpm_event