-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
64 lines (51 loc) · 2.04 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
# Deny access to all hidden files in root
<FilesMatch "^\.(.+)$">
order deny,allow
deny from all
</FilesMatch>
# rewrite rules
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Do not redirect for SSH public key file
RewriteRule key.pub - [L]
# block all files in the content folder from being accessed directly
RewriteRule ^content/(.*) index.php [L]
# block all files in the node_modules folder from being accessed directly
RewriteRule ^node_modules/(.*) index.php [L]
# block all files in the scripts folder from being accessed directly
RewriteRule ^scripts/(.*) index.php [L]
# block all files in the views folder from being accessed directly
RewriteRule ^site/(.*) index.php [L]
# block all files in the .git folder from being accessed directly
RewriteRule ^.git/(.*) index.php [L]
# block all development related files in project root (*.md, *.js, *.json, *.sh, *.lock)
RewriteRule ^[a-zA-U0-9\.\-\_]+(\.js|\.json|\.sh|\.lock|\.md)$ index.php [L]
# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
</IfModule>
# 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>
# Add caching headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 2 weeks"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 4 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/javascript "access plus 2 weeks"
ExpiresByType application/x-icon "access plus 1 year"
</IfModule>