.htaccess 2.5 KB

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