forked from alshedivat/al-folio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
91 lines (91 loc) · 3.9 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
##-- Default charset
AddDefaultCharset UTF-8
#AddDefaultCharset ISO-8859-15
##-- Disable the server signature
ServerSignature Off
##-- Turn off ETags in HTTP-header (use both directives)
<IfModule mod_headers.c>
Header unset ETag
RequestHeader unset Proxy
</IfModule>
FileETag None
##-- When caching of gzipped JS and CSS files is used, enable this setting
<IfModule mod_headers.c>
Header set Vary Accept-Encoding
</IfModule>
##-- when using Provider 1&1 set the following lines to activate PHP5
#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php
##-- Add Mime Types
<IfModule mod_mime.c>
AddType application/font-woff2 .woff2
</IfModule>
# Disable directory browsing (disabled by default as this causes problems on some servers because they don't allow AllowOverride Directive for Options)
#Options -Indexes
##-- Enable the compression for any type of content
<IfModule mod_deflate.c>
<FilesMatch "(\.js|\.css|\.html|\.htm|\.php|\.xml|\.ico|\.jpg|\.jpeg|\.png|\.gif|\.svg|\.woff|\.woff2|\.ttf|\.otf|\.eot|\.JS|\.CSS|\.HTML|\.HTM|\.PHP|\.XML|\.ICO|\.JPG|\.JPEG|\.PNG|\.GIF|\.SVG|\.WOFF|\.WOFF2|\.TTF|\.OTF|\.EOT)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
##-- Customization of HTTP request and response headers
<IfModule mod_headers.c>
<FilesMatch "(\.ico|\.jpg|\.jpeg|\.png|\.gif|\.swf|\.flv|\.svg|\.ICO|\.JPG|\.JPEG|\.PNG|\.GIF|\.SWF|\.FLV|\.SVG)$">
Header set Cache-Control "max-age=2592000, public, must-revalidate"
</FilesMatch>
<FilesMatch "(\.woff|\.woff2|\.ttf|\.otf|\.eot|\.WOFF|\.WOFF2|\.TTF|\.OTF|\.EOT)$">
Header set Cache-Control "max-age=2592000, public, must-revalidate"
</FilesMatch>
<FilesMatch "(\.css|\.js|\.CSS|\.JS)$">
Header set Cache-Control "max-age=604800, private, must-revalidate"
</FilesMatch>
<FilesMatch "(\.xml|\.txt|\.XML|\.TXT)$">
Header set Cache-Control "max-age=604800, public, must-revalidate"
</FilesMatch>
<FilesMatch "(\.html|\.htm|\.php|\.HTML|\.HTM|\.PHP)$">
Header set Cache-Control "max-age=1, private, must-revalidate"
</FilesMatch>
</IfModule>
##-- Generation of Expires and Cache-Control HTTP headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/webp "access plus 2592000 seconds"
ExpiresByType image/svg+xml "access plus 2592000 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
ExpiresByType application/x-javascript "access plus 604800 seconds"
ExpiresByType application/javascript "access plus 604800 seconds"
ExpiresByType text/x-component "access plus 604800 seconds"
ExpiresByType font/truetype "access plus 604800 seconds"
ExpiresByType font/opentype "access plus 604800 seconds"
ExpiresByType application/x-font-ttf "access plus 604800 seconds"
ExpiresByType application/x-font-woff "access plus 604800 seconds"
ExpiresByType application/font-woff "access plus 604800 seconds"
ExpiresByType application/vnd.ms-fontobject "access plus 604800 seconds"
ExpiresByType image/x-icon "access plus 604800 seconds"
<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# Check if browser supports WebP images
RewriteCond %{HTTP_ACCEPT} image/webp
# Check if WebP replacement image exists
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
# Serve WebP image instead
RewriteRule (.+)\.(jpe?g|png|gif)$ $1.webp [T=image/webp,E=REQUEST_image]
</IfModule>
<IfModule mod_headers.c>
# Vary: Accept for all the requests to jpeg, png and gif
Header append Vary Accept env=REQUEST_image
</IfModule>
<IfModule mod_mime.c>
AddType image/webp .webp
</IfModule>