1
0

.htaccess 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 mod_lsapi.c>
  11. SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
  12. RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
  13. </IfModule>
  14. </IfModule>
  15. <IfModule mod_env.c>
  16. # Add security and privacy related headers
  17. # Avoid doubled headers by unsetting headers in "onsuccess" table,
  18. # then add headers to "always" table: https://github.com/nextcloud/server/pull/19002
  19. Header onsuccess unset Referrer-Policy
  20. Header always set Referrer-Policy "no-referrer"
  21. Header onsuccess unset X-Content-Type-Options
  22. Header always set X-Content-Type-Options "nosniff"
  23. Header onsuccess unset X-Frame-Options
  24. Header always set X-Frame-Options "SAMEORIGIN"
  25. Header onsuccess unset X-Permitted-Cross-Domain-Policies
  26. Header always set X-Permitted-Cross-Domain-Policies "none"
  27. Header onsuccess unset X-Robots-Tag
  28. Header always set X-Robots-Tag "noindex, nofollow"
  29. Header onsuccess unset X-XSS-Protection
  30. Header always set X-XSS-Protection "1; mode=block"
  31. SetEnv modHeadersAvailable true
  32. </IfModule>
  33. # Add cache control for static resources
  34. <FilesMatch "\.(css|js|svg|gif|png|jpg|ico|wasm|tflite)$">
  35. <If "%{QUERY_STRING} =~ /(^|&)v=/">
  36. Header set Cache-Control "max-age=15778463, immutable"
  37. </If>
  38. <Else>
  39. Header set Cache-Control "max-age=15778463"
  40. </Else>
  41. </FilesMatch>
  42. # Let browsers cache WOFF files for a week
  43. <FilesMatch "\.woff2?$">
  44. Header set Cache-Control "max-age=604800"
  45. </FilesMatch>
  46. </IfModule>
  47. <IfModule mod_php.c>
  48. php_value mbstring.func_overload 0
  49. php_value default_charset 'UTF-8'
  50. php_value output_buffering 0
  51. <IfModule mod_env.c>
  52. SetEnv htaccessWorking true
  53. </IfModule>
  54. </IfModule>
  55. <IfModule mod_mime.c>
  56. AddType image/svg+xml svg svgz
  57. AddType application/wasm wasm
  58. AddEncoding gzip svgz
  59. # Serve ESM javascript files (.mjs) with correct mime type
  60. AddType text/javascript js mjs
  61. </IfModule>
  62. <IfModule mod_dir.c>
  63. DirectoryIndex index.php index.html
  64. </IfModule>
  65. <IfModule pagespeed_module>
  66. ModPagespeed Off
  67. </IfModule>
  68. <IfModule mod_rewrite.c>
  69. RewriteEngine on
  70. RewriteCond %{HTTP_USER_AGENT} DavClnt
  71. RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  72. RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  73. RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  74. RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  75. RewriteRule ^remote/(.*) remote.php [QSA,L]
  76. RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  77. RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
  78. RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
  79. </IfModule>
  80. AddDefaultCharset utf-8
  81. Options -Indexes