-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.htaccess
97 lines (77 loc) · 2.91 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
# .htaccess #
# CORS enabled image
# https://developer.mozilla.org/en-US/docs/HTML/CORS_Enabled_Image
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
<FilesMatch "\.(cur|gif|ico|jpe?g|png|svgz?|webp)$">
SetEnvIf Origin ":" IS_CORS
Header set Access-Control-Allow-Origin "*" env=IS_CORS
</FilesMatch>
</IfModule>
</IfModule>
# Web fonts access
# http://stackoverflow.com/questions/5008944/how-to-add-an-access-control-allow-origin-header
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|otf|eot|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
# Custom error pages
# http://httpd.apache.org/docs/current/mod/core.html#errordocument
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
# UTF-8 encoding
# http://www.w3.org/International/questions/qa-htaccess-charset.en
AddDefaultCharset utf-8
# URL Rewriting
# http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
# Delete this line and uncomment the lines below to get started with URL rewriting
# <IfModule mod_rewrite.c>
# Options +FollowSymlinks
# RewriteEngine On
# </IfModule>
# Stop directory listing
# http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# Block access to backup files and original (source) files
<FilesMatch "(^#.*#|\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|sw[op])|~)$">
order allow,deny
deny from all
</FilesMatch>
# Enable gzip
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
# Enable deflate
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
# Leverage browser caching, as defined by Google PageSpeed
# https://developers.google.com/speed/docs/best-practices/caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>