htaccess.dist 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # Elgg htaccess directives
  2. <FilesMatch "(nginx|htaccess).dist">
  3. order allow,deny
  4. deny from all
  5. </FilesMatch>
  6. # Don't allow listing directories
  7. Options -Indexes
  8. # Follow symbolic links
  9. Options +FollowSymLinks
  10. # Default handler
  11. DirectoryIndex index.php
  12. ############################
  13. # BROWSER CACHING
  14. # Make sure .ico has proper MIME type, allowing mod_expires to handle them.
  15. <IfModule mod_mime.c>
  16. AddType image/vnd.microsoft.icon .ico
  17. </IfModule>
  18. # The expires module controls the Expires and Cache-Control headers. Elgg sets
  19. # these for dynamically generated files so this is just for static files.
  20. <IfModule mod_expires.c>
  21. ExpiresActive On
  22. ExpiresDefault "access plus 1 year"
  23. </IfModule>
  24. # Conditional requests are controlled through Last-Modified and ETag headers.
  25. # Elgg sets these on dynamically generated cacheable files so this is just for
  26. # static files. Note: Apache sends Last-Modified by default on static files so
  27. # I don't think we need to be sending ETag for these files.
  28. <FilesMatch "\.(jpg|jpeg|gif|png|mp3|flv|mov|avi|3pg|html|htm|swf|js|css|ico)$">
  29. FileETag MTime Size
  30. </FilesMatch>
  31. ############################
  32. # PHP SETTINGS
  33. <IfModule mod_php5.c>
  34. # limit the maximum memory consumed by the php script to 64 MB
  35. php_value memory_limit 64M
  36. # register_globals is deprecated as of PHP 5.3.0 - disable it for security reasons.
  37. php_value register_globals 0
  38. # post_max_size is the maximum size of ALL the data that is POST'ed to php at a time (8 MB)
  39. php_value post_max_size 8388608
  40. # upload_max_filesize is the maximum size of a single uploaded file (5 MB)
  41. php_value upload_max_filesize 5242880
  42. # on development servers, set to 1 to display errors. Set to 0 on production servers.
  43. php_value display_errors 0
  44. </IfModule>
  45. ############################
  46. # COMPRESSION
  47. # Turn on mod_gzip if available
  48. <IfModule mod_gzip.c>
  49. mod_gzip_on yes
  50. mod_gzip_dechunk yes
  51. mod_gzip_keep_workfiles No
  52. mod_gzip_minimum_file_size 1000
  53. mod_gzip_maximum_file_size 1000000
  54. mod_gzip_maximum_inmem_size 1000000
  55. mod_gzip_item_include mime ^text/.*
  56. mod_gzip_item_include mime ^application/javascript$
  57. mod_gzip_item_include mime ^application/x-javascript$
  58. # Exclude old browsers and images since IE has trouble with this
  59. mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
  60. mod_gzip_item_exclude mime ^image/.*
  61. </IfModule>
  62. ## Apache2 deflate support if available
  63. ##
  64. ## Important note: mod_headers is required for correct functioning across proxies.
  65. ##
  66. <IfModule mod_deflate.c>
  67. AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript image/svg+xml
  68. BrowserMatch ^Mozilla/4 gzip-only-text/html
  69. BrowserMatch ^Mozilla/4\.[0678] no-gzip
  70. BrowserMatch \bMSIE !no-gzip
  71. <IfModule mod_headers.c>
  72. Header append Vary User-Agent env=!dont-vary
  73. </IfModule>
  74. # The following is to disable compression for actions. The reason being is that these
  75. # may offer direct downloads which (since the initial request comes in as text/html and headers
  76. # get changed in the script) get double compressed and become unusable when downloaded by IE.
  77. SetEnvIfNoCase Request_URI action\/* no-gzip dont-vary
  78. SetEnvIfNoCase Request_URI actions\/* no-gzip dont-vary
  79. </IfModule>
  80. ############################
  81. # REWRITE RULES
  82. <IfModule mod_rewrite.c>
  83. RewriteEngine on
  84. # If Elgg is in a subdirectory on your site, you might need to add a RewriteBase line
  85. # containing the path from your site root to elgg's root. e.g. If your site is
  86. # http://example.com/ and Elgg is in http://example.com/sites/elgg/, you might need
  87. #
  88. #RewriteBase /sites/elgg/
  89. #
  90. # here, only without the # in front.
  91. #
  92. # If you're not running Elgg in a subdirectory on your site, but still getting lots
  93. # of 404 errors beyond the front page, you could instead try:
  94. #
  95. #RewriteBase /
  96. # If your users receive the message "Sorry, logging in from a different domain is not permitted"
  97. # you must make sure your login form is served from the same hostname as your site pages.
  98. # See http://learn.elgg.org/en/stable/appendix/faqs/general.html#login-token-mismatch for more info.
  99. #
  100. # If you must add RewriteRules to change hostname, add them directly below (above all the others)
  101. # hide all dot files/dirs (.git)
  102. RewriteRule (^\.|/\.) - [F]
  103. # cache handler to skip engine
  104. RewriteRule ^cache\/(.*)$ engine/handlers/cache_handler.php?request=$1&%{QUERY_STRING} [L]
  105. # deprecated export handler
  106. RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/?$ engine/handlers/export_handler.php?view=$1&guid=$2 [L]
  107. RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/([A-Za-z]+)\/([A-Za-z0-9\_]+)\/$ engine/handlers/export_handler.php?view=$1&guid=$2&type=$3&idname=$4 [L]
  108. # rule for rewrite module test during install - can be removed after installation
  109. RewriteRule ^rewrite.php$ install.php [L]
  110. # Everything else that isn't a file gets routed through Elgg
  111. RewriteCond %{REQUEST_FILENAME} !-f
  112. RewriteCond %{REQUEST_FILENAME} !-d
  113. RewriteRule ^(.*)$ index.php?__elgg_uri=$1 [QSA,L]
  114. </IfModule>