Skip to content

Commit 1272dd9

Browse files
committed
add sample .htaccess file for gzip compression
1 parent 238e18e commit 1272dd9

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
topo3.json
2+
.htaccess
23
*.bak

_.htaccess

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# it is a god idee to enable gzip compression. Saves 80-90% on the transferred filesize
2+
AddType application/json .json
3+
4+
# gzip output
5+
# see http://www.xpertdeveloper.com/2012/04/htaccess-gzip-compression/
6+
<IfModule mod_deflate.c>
7+
# force deflate for mangled headers
8+
# developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
9+
<IfModule mod_setenvif.c>
10+
<IfModule mod_headers.c>
11+
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
12+
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
13+
</IfModule>
14+
</IfModule>
15+
16+
# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
17+
<IfModule filter_module>
18+
FilterDeclare COMPRESS
19+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
20+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
21+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
22+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
23+
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
24+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
25+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
26+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
27+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
28+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
29+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
30+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
31+
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
32+
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
33+
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
34+
FilterChain COMPRESS
35+
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
36+
</IfModule>
37+
38+
<IfModule !mod_filter.c>
39+
# Legacy versions of Apache
40+
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
41+
AddOutputFilterByType DEFLATE application/javascript
42+
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
43+
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml
44+
AddOutputFilterByType DEFLATE application/atom+xml
45+
AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject
46+
AddOutputFilterByType DEFLATE application/x-font-ttf font/opentype
47+
</IfModule>
48+
</IfModule>

0 commit comments

Comments
 (0)