Add diagnostics to check integrity of data folder master
[photocalendar.git] / .htaccess
Alexander Sadleir 1 # Apache configuration file
2 # httpd.apache.org/docs/2.2/mod/quickreference.html
3
4 # Note .htaccess files are an overhead, this logic should be in your Apache config if possible
5 # httpd.apache.org/docs/2.2/howto/htaccess.html
6
7 # Techniques in here adapted from all over, including:
8 # Kroc Camen: camendesign.com/.htaccess
9 # perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
10 # Sample .htaccess file of CMS MODx: modxcms.com
11
12
13 ###
14 ### If you run a webserver other than apache, consider:
15 ### github.com/paulirish/html5-boilerplate-server-configs
16 ###
17
18
19
20 # ----------------------------------------------------------------------
21 # Better website experience for IE users
22 # ----------------------------------------------------------------------
23
24 # Force the latest IE version, in various cases when it may fall back to IE7 mode
25 # github.com/rails/rails/commit/123eb25#commitcomment-118920
26 # Use ChromeFrame if it's installed for a better experience for the poor IE folk
27
28 <IfModule mod_headers.c>
29 Header set X-UA-Compatible "IE=Edge,chrome=1"
30 # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
31 <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|xpi|safariextz|vcf)$" >
32 Header unset X-UA-Compatible
33 </FilesMatch>
34 </IfModule>
35
36
37 # ----------------------------------------------------------------------
38 # Cross-domain AJAX requests
39 # ----------------------------------------------------------------------
40
41 # Serve cross-domain ajax requests, disabled.
42 # enable-cors.org
43 # code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
44
45 # <IfModule mod_headers.c>
46 # Header set Access-Control-Allow-Origin "*"
47 # </IfModule>
48
49
50
51 # ----------------------------------------------------------------------
52 # Webfont access
53 # ----------------------------------------------------------------------
54
55 # Allow access from all domains for webfonts.
56 # Alternatively you could only whitelist your
57 # subdomains like "subdomain.example.com".
58
59 <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
60 <IfModule mod_headers.c>
61 Header set Access-Control-Allow-Origin "*"
62 </IfModule>
63 </FilesMatch>
64
65
66
67 # ----------------------------------------------------------------------
68 # Proper MIME type for all files
69 # ----------------------------------------------------------------------
70
71
72 # JavaScript
73 # Normalize to standard type (it's sniffed in IE anyways)
74 # tools.ietf.org/html/rfc4329#section-7.2
75 AddType application/javascript js
76
77 # Audio
78 AddType audio/ogg oga ogg
79 AddType audio/mp4 m4a
80
81 # Video
82 AddType video/ogg ogv
83 AddType video/mp4 mp4 m4v
84 AddType video/webm webm
85
86 # SVG.
87 # Required for svg webfonts on iPad
88 # twitter.com/FontSquirrel/status/14855840545
89 AddType image/svg+xml svg svgz
90 AddEncoding gzip svgz
91
92 # Webfonts
93 AddType application/vnd.ms-fontobject eot
94 AddType application/x-font-ttf ttf ttc
95 AddType font/opentype otf
96 AddType application/x-font-woff woff
97
98 # Assorted types
99 AddType image/x-icon ico
100 AddType image/webp webp
101 AddType text/cache-manifest appcache manifest
102 AddType text/x-component htc
103 AddType application/x-chrome-extension crx
104 AddType application/x-xpinstall xpi
105 AddType application/octet-stream safariextz
106 AddType text/x-vcard vcf
107
108
109
110 # ----------------------------------------------------------------------
111 # Allow concatenation from within specific js and css files
112 # ----------------------------------------------------------------------
113
114 # e.g. Inside of script.combined.js you could have
115 # <!--#include file="libs/jquery-1.5.0.min.js" -->
116 # <!--#include file="plugins/jquery.idletimer.js" -->
117 # and they would be included into this single file.
118
119 # This is not in use in the boilerplate as it stands. You may
120 # choose to name your files in this way for this advantage or
121 # concatenate and minify them manually.
122 # Disabled by default.
123
124 #<FilesMatch "\.combined\.js$">
125 # Options +Includes
126 # AddOutputFilterByType INCLUDES application/javascript application/json
127 # SetOutputFilter INCLUDES
128 #</FilesMatch>
129 #<FilesMatch "\.combined\.css$">
130 # Options +Includes
131 # AddOutputFilterByType INCLUDES text/css
132 # SetOutputFilter INCLUDES
133 #</FilesMatch>
134
135
136 # ----------------------------------------------------------------------
137 # Gzip compression
138 # ----------------------------------------------------------------------
139
140 <IfModule mod_deflate.c>
141
142 # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
143 <IfModule mod_setenvif.c>
144 <IfModule mod_headers.c>
145 SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
146 RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
147 </IfModule>
148 </IfModule>
149
150 # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
151 <IfModule filter_module>
152 FilterDeclare COMPRESS
153 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
154 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
155 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
156 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
157 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
158 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
159 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
160 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
161 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
162 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
163 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
164 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
165 FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
166 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
167 FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
168 FilterChain COMPRESS
169 FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
170 </IfModule>
171
172 <IfModule !mod_filter.c>
173 # Legacy versions of Apache
174 AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
175 AddOutputFilterByType DEFLATE application/javascript
176 AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
177 AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
178 AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
179 </IfModule>
180 </IfModule>
181
182
183
184 # ----------------------------------------------------------------------
185 # Expires headers (for better cache control)
186 # ----------------------------------------------------------------------
187
188 # These are pretty far-future expires headers.
189 # They assume you control versioning with cachebusting query params like
190 # <script src="application.js?20100608">
191 # Additionally, consider that outdated proxies may miscache
192 # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
193
194 # If you don't use filenames to version, lower the CSS and JS to something like
195 # "access plus 1 week" or so.
196
197 <IfModule mod_expires.c>
198 ExpiresActive on
199
200 # Perhaps better to whitelist expires rules? Perhaps.
201 ExpiresDefault "access plus 1 month"
202
203 # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
204 ExpiresByType text/cache-manifest "access plus 0 seconds"
205
206 # Your document html
207 ExpiresByType text/html "access plus 0 seconds"
208
209 # Data
210 ExpiresByType text/xml "access plus 0 seconds"
211 ExpiresByType application/xml "access plus 0 seconds"
212 ExpiresByType application/json "access plus 0 seconds"
213
214 # Feed
215 ExpiresByType application/rss+xml "access plus 1 hour"
216 ExpiresByType application/atom+xml "access plus 1 hour"
217
218 # Favicon (cannot be renamed)
219 ExpiresByType image/x-icon "access plus 1 week"
220
221 # Media: images, video, audio
222 ExpiresByType image/gif "access plus 1 month"
223 ExpiresByType image/png "access plus 1 month"
224 ExpiresByType image/jpg "access plus 1 month"
225 ExpiresByType image/jpeg "access plus 1 month"
226 ExpiresByType video/ogg "access plus 1 month"
227 ExpiresByType audio/ogg "access plus 1 month"
228 ExpiresByType video/mp4 "access plus 1 month"
229 ExpiresByType video/webm "access plus 1 month"
230
231 # HTC files (css3pie)
232 ExpiresByType text/x-component "access plus 1 month"
233
234 # Webfonts
235 ExpiresByType font/truetype "access plus 1 month"
236 ExpiresByType font/opentype "access plus 1 month"
237 ExpiresByType application/x-font-woff "access plus 1 month"
238 ExpiresByType image/svg+xml "access plus 1 month"
239 ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
240
241 # CSS and JavaScript
242 ExpiresByType text/css "access plus 1 year"
243 ExpiresByType application/javascript "access plus 1 year"
244
245 <IfModule mod_headers.c>
246 Header append Cache-Control "public"
247 </IfModule>
248
249 </IfModule>
250
251
252
253 # ----------------------------------------------------------------------
254 # ETag removal
255 # ----------------------------------------------------------------------
256
257 # FileETag None is not enough for every server.
258 <IfModule mod_headers.c>
259 Header unset ETag
260 </IfModule>
261
262 # Since we're sending far-future expires, we don't need ETags for
263 # static content.
264 # developer.yahoo.com/performance/rules.html#etags
265 FileETag None
266
267
268
269 # ----------------------------------------------------------------------
270 # Stop screen flicker in IE on CSS rollovers
271 # ----------------------------------------------------------------------
272
273 # The following directives stop screen flicker in IE on CSS rollovers - in
274 # combination with the "ExpiresByType" rules for images (see above). If
275 # needed, un-comment the following rules.
276
277 # BrowserMatch "MSIE" brokenvary=1
278 # BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
279 # BrowserMatch "Opera" !brokenvary
280 # SetEnvIf brokenvary 1 force-no-vary
281
282
283
284 # ----------------------------------------------------------------------
285 # Cookie setting from iframes
286 # ----------------------------------------------------------------------
287
288 # Allow cookies to be set from iframes (for IE only)
289 # If needed, uncomment and specify a path or regex in the Location directive
290
291 # <IfModule mod_headers.c>
292 # <Location />
293 # Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
294 # </Location>
295 # </IfModule>
296
297
298
299 # ----------------------------------------------------------------------
300 # Start rewrite engine
301 # ----------------------------------------------------------------------
302
303 # Turning on the rewrite engine is necessary for the following rules and features.
304 # FollowSymLinks must be enabled for this to work.
305
306 <IfModule mod_rewrite.c>
307 Options +FollowSymlinks
308 RewriteEngine On
309 </IfModule>
310
311
312
313 # ----------------------------------------------------------------------
314 # Suppress or force the "www." at the beginning of URLs
315 # ----------------------------------------------------------------------
316
317 # The same content should never be available under two different URLs - especially not with and
318 # without "www." at the beginning, since this can cause SEO problems (duplicate content).
319 # That's why you should choose one of the alternatives and redirect the other one.
320
321 # By default option 1 (no "www.") is activated. Remember: Shorter URLs are sexier.
322 # no-www.org/faq.php?q=class_b
323
324 # If you rather want to use option 2, just comment out all option 1 lines
325 # and uncomment option 2.
326 # IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
327
328 # ----------------------------------------------------------------------
329
330 # Option 1:
331 # Rewrite "www.example.com -> example.com"
332
333 <IfModule mod_rewrite.c>
334 RewriteCond %{HTTPS} !=on
335 RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
336 RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
337 </IfModule>
338
339 # ----------------------------------------------------------------------
340
341 # Option 2:
342 # To rewrite "example.com -> www.example.com" uncomment the following lines.
343 # Be aware that the following rule might not be a good idea if you
344 # use "real" subdomains for certain parts of your website.
345
346 # <IfModule mod_rewrite.c>
347 # RewriteCond %{HTTPS} !=on
348 # RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
349 # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
350 # </IfModule>
351
352
353
354 # ----------------------------------------------------------------------
355 # Built-in filename-based cache busting
356 # ----------------------------------------------------------------------
357
358 # If you're not using the build script to manage your filename version revving,
359 # you might want to consider enabling this, which will route requests for
360 # /css/style.20110203.css to /css/style.css
361
362 # To understand why this is important and a better idea than all.css?v1231,
363 # read: github.com/paulirish/html5-boilerplate/wiki/Version-Control-with-Cachebusting
364
365 # Uncomment to enable.
366 # <IfModule mod_rewrite.c>
367 # RewriteCond %{REQUEST_FILENAME} !-f
368 # RewriteCond %{REQUEST_FILENAME} !-d
369 # RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
370 # </IfModule>
371
372
373
374 # ----------------------------------------------------------------------
375 # Prevent SSL cert warnings
376 # ----------------------------------------------------------------------
377
378 # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
379 # https://www.example.com when your cert only allows https://secure.example.com
380 # Uncomment the following lines to use this feature.
381
382 # <IfModule mod_rewrite.c>
383 # RewriteCond %{SERVER_PORT} !^443
384 # RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
385 # </IfModule>
386
387
388
389 # ----------------------------------------------------------------------
390 # Prevent 404 errors for non-existing redirected folders
391 # ----------------------------------------------------------------------
392
393 # without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist
394 # e.g. /blog/hello : webmasterworld.com/apache/3808792.htm
395
396 Options -MultiViews
397
398
399
400 # ----------------------------------------------------------------------
401 # Custom 404 page
402 # ----------------------------------------------------------------------
403
404 # You can add custom pages to handle 500 or 403 pretty easily, if you like.
405 ErrorDocument 404 /404.html
406
407
408
409 # ----------------------------------------------------------------------
410 # UTF-8 encoding
411 # ----------------------------------------------------------------------
412
413 # Use UTF-8 encoding for anything served text/plain or text/html
414 AddDefaultCharset utf-8
415
416 # Force UTF-8 for a number of file formats
417 AddCharset utf-8 .html .css .js .xml .json .rss .atom
418
419
420
421 # ----------------------------------------------------------------------
422 # A little more security
423 # ----------------------------------------------------------------------
424
425
426 # Do we want to advertise the exact version number of Apache we're running?
427 # Probably not.
428 ## This can only be enabled if used in httpd.conf - It will not work in .htaccess
429 # ServerTokens Prod
430
431
432 # "-Indexes" will have Apache block users from browsing folders without a default document
433 # Usually you should leave this activated, because you shouldn't allow everybody to surf through
434 # every folder on your server (which includes rather private places like CMS system folders).
435 Options -Indexes
436
437
438 # Block access to "hidden" directories whose names begin with a period. This
439 # includes directories used by version control systems such as Subversion or Git.
440 <IfModule mod_rewrite.c>
441 RewriteRule "(^|/)\." - [F]
442 </IfModule>
443
444
445 # If your server is not already configured as such, the following directive
446 # should be uncommented in order to set PHP's register_globals option to OFF.
447 # This closes a major security hole that is abused by most XSS (cross-site
448 # scripting) attacks. For more information: http://php.net/register_globals
449 #
450 # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
451 #
452 # Your server does not allow PHP directives to be set via .htaccess. In that
453 # case you must make this change in your php.ini file instead. If you are
454 # using a commercial web host, contact the administrators for assistance in
455 # doing this. Not all servers allow local php.ini files, and they should
456 # include all PHP configurations (not just this one), or you will effectively
457 # reset everything to PHP defaults. Consult www.php.net for more detailed
458 # information about setting PHP directives.
459
460 # php_flag register_globals Off
461
462 # Rename session cookie to something else, than PHPSESSID
463 # php_value session.name sid
464
465 # Do not show you are using PHP
466 # Note: Move this line to php.ini since it won't work in .htaccess
467 # php_flag expose_php Off
468
469 # Level of log detail - log all errors
470 # php_value error_reporting -1
471
472 # Write errors to log file
473 # php_flag log_errors On
474
475 # Do not display errors in browser (production - Off, development - On)
476 # php_flag display_errors Off
477
478 # Do not display startup errors (production - Off, development - On)
479 # php_flag display_startup_errors Off
480
481 # Format errors in plain text
482 # Note: Leave this setting 'On' for xdebug's var_dump() output
483 # php_flag html_errors Off
484
485 # Show multiple occurrence of error
486 # php_flag ignore_repeated_errors Off
487
488 # Show same errors from different sources
489 # php_flag ignore_repeated_source Off
490
491 # Size limit for error messages
492 # php_value log_errors_max_len 1024
493
494 # Don't precede error with string (doesn't accept empty string, use whitespace if you need)
495 # php_value error_prepend_string " "
496
497 # Don't prepend to error (doesn't accept empty string, use whitespace if you need)
498 # php_value error_append_string " "
499
500 # Increase cookie security
501 <IfModule php5_module>
502 php_value session.cookie_httponly true
503 </IfModule>
504