-
Notifications
You must be signed in to change notification settings - Fork 3
/
.htaccess
154 lines (104 loc) · 4.22 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
RewriteEngine On
RewriteRule ^code(|/)$ code.php
RewriteRule ^login/$ loginprocess.php
RewriteRule ^logout/$ logoutprocess.php
RewriteRule ^register/$ registration.php
RewriteRule ^cloud-save/$ saveimage.php
RewriteRule ^cloud-delete/$ deleteimage.php
RewriteCond %{QUERY_STRING} ^user_id=(\d+)$
RewriteRule ^cloud-images/$ getimages.php?user_id=%1
##################
Options -MultiViews
Options -Indexes
# Force the latest IE version, in various cases when it may fall back to IE7 mode
# github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
</IfModule>
</IfModule>
<IfModule mod_headers.c>
# Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
# We need to inform proxies that content changes based on UA
Header append Vary User-Agent
# Cache control is set only if mod_headers is enabled, so that's unncessary to declare
</IfModule>
# video
AddType video/ogg ogg
AddType video/ogg ogv
AddType video/mp4 mp4
AddType video/webm webm
# Proper svg serving. Required for svg webfonts on iPad
# twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# webfonts
AddType application/vnd.ms-fontobject eot
AddType font/truetype ttf
AddType font/opentype otf
AddType font/woff woff
# assorted types
AddType image/vnd.microsoft.icon ico
AddType image/webp webp
AddType text/cache-manifest manifest
AddType text/x-component htc
AddType application/x-chrome-extension crx
# gzip compression.
<IfModule mod_deflate.c>
# html, txt, css, js, json, xml, htc:
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
# webfonts and svg:
<FilesMatch "\.(ttf|otf|eot|svg)$" >
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
# disable gzip compression for video files
SetEnvIfNoCase Request_URI \.(og[gv]|mp4|m4v|webm)$ no-gzip dont-vary
# these are pretty far-future expires headers
# they assume you control versioning with cachebusting query params like
# <script src="application.js?20100608">
# additionally, consider that outdated proxies may miscache
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
# if you don't use filenames to version, lower the css and js to something like
# "access plus 1 week" or so
<IfModule mod_headers.c>
# cache.manifest needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
<FilesMatch "\.(manifest)$">
Header set Expires "access plus 0 seconds"
</FilesMatch>
# media: images, video, audio
<FilesMatch "\.(jpg|jpeg|png|gif|swf|ogg|ogv|mp4|mp3|webm)$">
Header set Expires "access plus 1 month"
</FilesMatch>
# webfonts
<FilesMatch "\.(ttf|otf|woff|svg|svgz|eot)$">
Header set Expires "access plus 1 month"
</FilesMatch>
# css and javascript
<FilesMatch "\.(css|js)$">
Header set Expires "access plus 1 month"
</FilesMatch>
Header append Cache-Control "public"
</IfModule>
# Since we're sending far-future expires, we don't need ETags for
# static content.
# developer.yahoo.com/performance/rules.html#etags
FileETag None
# you probably want www.example.com to forward to example.com -- shorter URLs are sexier.
# no-www.org/faq.php?q=class_b
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
# use utf-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8
# force utf-8 for a number of file formats
AddCharset utf-8 .html .css .js .xml .json .rss
# We don't need to tell everyone we're apache.
ServerSignature Off