-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.htaccess
106 lines (86 loc) · 4.67 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
# ------------------------------------------------------------------------------------------
#
# ### PWA Bunga! .htaccess
#
# This htaccess configuration file is used by the Apache web server,
# it improves performance, security and manages redirects
#
# Documentation of .htaccess
# --------------------------
# https://pwabunga.com/documentation/starter.html#htaccess
#
# ------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------
#
# ### PERFORMANCE
#
# ------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------
# ## Cache-Control Headers
# ----------------------------------------------------------------------
<IfModule mod_headers.c>
<FilesMatch "\.(ico|jpe?g|png|gif|svg|css|webp|woff2|gz)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
<FilesMatch "\.(js)$">
Header set Cache-Control "max-age=2592000, private"
</FilesMatch>
<filesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, public"
</filesMatch>
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
# ----------------------------------------------------------------------
# ## Deflate Outpout filters
# ----------------------------------------------------------------------
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE "application/atom+xml" "application/javascript" "application/json" "application/ld+json" "application/manifest+json" "application/rdf+xml" "application/rss+xml" "application/schema+json" "application/vnd.geo+json" "application/vnd.ms-fontobject" "application/x-font-ttf" "application/x-javascript" "application/x-web-app-manifest+json" "application/xhtml+xml" "application/xml" "font/eot" "font/opentype" "image/bmp" "image/svg+xml" "image/vnd.microsoft.icon" "image/x-icon" "text/cache-manifest" "text/css" "text/html" "text/javascript" "text/plain" "text/vcard" "text/vnd.rim.location.xloc" "text/vtt" "text/x-component" "text/x-cross-domain-policy" "text/xml"
# ------------------------------------------------------------------------------------------
#
# ### SECURITY
#
# ------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------
# ## http:// to https://
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# ----------------------------------------------------------------------
# ## Disables directory indexing
# ----------------------------------------------------------------------
Options All -Indexes
# ----------------------------------------------------------------------
# ## Protect hidden files from being viewed
# ----------------------------------------------------------------------
<files .*>
order allow,deny
deny from all
</files>
# ------------------------------------------------------------------------------------------
#
# ### Redirect
#
# ------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------
# ## Errors redirect
# ----------------------------------------------------------------------
ErrorDocument 403 https://demo.pwabunga.com/403.html
ErrorDocument 404 https://demo.pwabunga.com/404.html
# ----------------------------------------------------------------------
# ## domain.com to www.domain.com
# ----------------------------------------------------------------------
# <IfModule mod_rewrite.c>
# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
# RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# </IfModule>
# ----------------------------------------------------------------------
# ## www.domain.com to domain.com
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
</IfModule>