.htaccess 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <IfModule mod_headers.c>
  2. <IfModule mod_setenvif.c>
  3. <IfModule mod_fcgid.c>
  4. SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
  5. RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
  6. </IfModule>
  7. <IfModule mod_proxy_fcgi.c>
  8. SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
  9. </IfModule>
  10. </IfModule>
  11. <IfModule mod_env.c>
  12. # Add security and privacy related headers
  13. Header set X-Content-Type-Options "nosniff"
  14. Header set X-XSS-Protection "1; mode=block"
  15. Header set X-Robots-Tag "none"
  16. Header set X-Download-Options "noopen"
  17. Header set X-Permitted-Cross-Domain-Policies "none"
  18. Header set Referrer-Policy "no-referrer"
  19. SetEnv modHeadersAvailable true
  20. </IfModule>
  21. # Add cache control for static resources
  22. <FilesMatch "\.(css|js|svg|gif)$">
  23. Header set Cache-Control "max-age=15778463"
  24. </FilesMatch>
  25. # Let browsers cache WOFF files for a week
  26. <FilesMatch "\.woff2?$">
  27. Header set Cache-Control "max-age=604800"
  28. </FilesMatch>
  29. </IfModule>
  30. <IfModule mod_php7.c>
  31. php_value mbstring.func_overload 0
  32. php_value default_charset 'UTF-8'
  33. php_value output_buffering 0
  34. <IfModule mod_env.c>
  35. SetEnv htaccessWorking true
  36. </IfModule>
  37. </IfModule>
  38. <IfModule mod_rewrite.c>
  39. RewriteEngine on
  40. RewriteCond %{HTTP_USER_AGENT} DavClnt
  41. RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  42. RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  43. RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  44. RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  45. RewriteRule ^\.well-known/webfinger /public.php?service=webfinger [QSA,L]
  46. RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  47. RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  48. RewriteRule ^remote/(.*) remote.php [QSA,L]
  49. RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  50. RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  51. RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
  52. </IfModule>
  53. <IfModule mod_mime.c>
  54. AddType image/svg+xml svg svgz
  55. AddEncoding gzip svgz
  56. </IfModule>
  57. <IfModule mod_dir.c>
  58. DirectoryIndex index.php index.html
  59. </IfModule>
  60. AddDefaultCharset utf-8
  61. Options -Indexes
  62. <IfModule pagespeed_module>
  63. ModPagespeed Off
  64. </IfModule>