PageRenderTime 48ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/.htaccess

https://github.com/muchael/expressolivre
#! | 208 lines | 183 code | 25 blank | 0 comment | 0 complexity | c5d93ef4fa1dd2c478336a760f5fb52e MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, BSD-2-Clause, BSD-3-Clause, AGPL-3.0
  1. #
  2. # Configuracoes principais
  3. #
  4. Options -ExecCGI -MultiViews -Indexes
  5. DirectoryIndex index.php index.html index.htm
  6. DefaultLanguage pt-BR
  7. AddDefaultCharset ISO-8859-1
  8. ServerSignature Off
  9. #-> http://www.htaccesselite.com/htaccess/cache-control-http-headers-vt65.html
  10. # 300 5 M
  11. # 2700 45 M
  12. # 3600 1 H
  13. # 54000 15 H
  14. # 86400 1 D
  15. # 518400 6 D
  16. # 604800 1 W
  17. # 1814400 3 W
  18. # 2419200 1 M
  19. # 26611200 11 M
  20. # 29030400 1 Y (never expire)
  21. ## HEADER CACHING ##
  22. #-> http://www.htaccesselite.com/htaccess/caching-using-header-vt2.html
  23. #<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico)$">
  24. # Header set Cache-Control "max-age=2592000"
  25. #</FilesMatch>
  26. #<FilesMatch "\.(js|css|pdf|swf)$">
  27. # Header set Cache-Control "max-age=604800"
  28. #</FilesMatch>
  29. #<FilesMatch "\.(html|htm|txt)$">
  30. # Header set Cache-Control "max-age=600"
  31. #</FilesMatch>
  32. #<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
  33. # Header unset Cache-Control
  34. #</FilesMatch>
  35. ## ALTERNATE EXPIRES CACHING ##
  36. #-> htaccesselite.com/d/use-htaccess-to-speed-up-your-site-discussion-vt67.html
  37. <ifModule mod_expires.c>
  38. ExpiresActive On
  39. # ExpiresDefault A0
  40. ExpiresDefault "access plus 1 day"
  41. # Permite que os arquivos sejam "cacheados" tanto para http quanto para https
  42. # Header set Cache-Control "public"
  43. # ExpiresByType text/html "access plus 4 hour"
  44. # ExpiresByType text/plain "access plus 2 hour"
  45. # ExpiresByType text/css "access plus 2 hour"
  46. # ExpiresByType text/javascript "access plus 1 hour"
  47. # ExpiresByType application/x-javascript "access plus 1 hour"
  48. ExpiresByType image/gif "access plus 1 week"
  49. ExpiresByType image/jpg "access plus 1 week"
  50. ExpiresByType image/png "access plus 1 week"
  51. #<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
  52. #ExpiresActive Off
  53. # Sem cache!
  54. #ExpiresDefault A0
  55. #Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
  56. #Header set Pragma "no-cache"
  57. #</FilesMatch>
  58. </ifModule>
  59. #
  60. # Compactacao
  61. #
  62. <IfModule mod_deflate.c>
  63. SetOutputFilter DEFLATE
  64. AddOutputFilterByType DEFLATE application/x-httpd-php
  65. AddOutputFilterByType DEFLATE application/x-javascript
  66. AddOutputFilterByType DEFLATE application/x-httpd-fastphp
  67. AddOutputFilterByType DEFLATE application/xhtml+xml
  68. AddOutputFilterByType DEFLATE application/xml
  69. AddOutputFilterByType DEFLATE application/rss+xml
  70. AddOutputFilterByType DEFLATE application/atom_xml
  71. AddOutputFilterByType DEFLATE text/html
  72. AddOutputFilterByType DEFLATE text/plain
  73. AddOutputFilterByType DEFLATE text/xml
  74. AddOutputFilterByType DEFLATE text/css
  75. AddOutputFilterByType DEFLATE image/svg+xml
  76. # Use low settings for compression to make sure impact on server is low
  77. #DeflateMemLevel 2
  78. #Highest 9 - Lowest 1
  79. #DeflateCompressionLevel 9
  80. #Skip browsers with known problems
  81. BrowserMatch ^Mozilla/4 gzip-only-text/html
  82. BrowserMatch ^Mozilla/4\.0[678] no-gzip
  83. BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  84. # properly handle requests coming from behind proxies
  85. <IfModule mod_headers.c>
  86. # Make sure proxies don't deliver the wrong content
  87. Header append Vary User-Agent env=!dont-vary
  88. </IfModule>
  89. SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
  90. SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
  91. SetEnvIfNoCase Request_URI \.(?:avi|mov|mp3|ogg|wmv|wma)$ no-gzip dont-vary
  92. SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
  93. # Log file compression
  94. # DeflateFilterNote Input instream
  95. # DeflateFilterNote Output outstream
  96. # DeflateFilterNote Ratio ratio
  97. # LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
  98. # CustomLog /var/log/apache2/deflate.log deflate
  99. </ifModule>
  100. #
  101. # Reescritas e redirecionamentos
  102. #
  103. RewriteEngine On
  104. ## DENY REQUEST BASED ON REQUEST METHOD ##
  105. RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|HEAD)$ [NC]
  106. RewriteRule ^.*$ - [F]
  107. RewriteRule ^rest(.*)$ prototype/rest/$1 [QSA,L]
  108. RewriteRule ^Microsoft-Server-ActiveSync(.*) zpush/index.php$1 [E=ACTIVESYNC:true,E=REMOTE_USER:%{HTTP:Authorization}]
  109. #
  110. # Seguranca e restricoes de acesso
  111. #
  112. # Ao próprio htaccess e outros arquivos sensiveis (como senhas)
  113. <Files ~ "\.(htaccess|htpasswd|ini|srv|log|sh|svn|git|gitignore)$">
  114. Order Allow,Deny
  115. Deny from all
  116. Satisfy any
  117. </Files>
  118. #<Location /setup>
  119. # Options None
  120. # Order deny,allow
  121. # # Sua rede local
  122. # allow from 192.168.0.0/24
  123. #</Location>
  124. #
  125. # Configuracoes do PHP para o Expresso
  126. # IMPORTANTE: estas configurações não serão carregadas
  127. # em ambientes que executam o PHP via FastCGI, FPM,
  128. # ou similares. Nestes casos, estas configurações
  129. # devem ser adicionadas diretamente ao php.ini.
  130. #
  131. <IfModule mod_php5.c>
  132. # Configuracoes de sessao
  133. php_flag session.auto_start Off
  134. php_flag session.use_cookies Off
  135. # Uses dir as a session handler
  136. php_value session.save_handler "files"
  137. php_value session.save_path "/dev/shm"
  138. # Use memcache as a session handler
  139. #php_value session.save_handler "memcache"
  140. #php_value session.save_path "tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
  141. php_value session.serialize_handler "php"
  142. php_value session.gc_probability 1
  143. php_value session.gc_divisor 100
  144. php_value session.gc_maxlifetime 14400
  145. php_value session.cache_limiter nocache
  146. php_value session.cache_expire 180
  147. php_flag session.use_trans_sid Off
  148. php_flag short_open_tag On
  149. php_flag zlib.output_compression Off
  150. php_flag output_buffering Off
  151. php_flag register_argc_argv On
  152. php_flag allow_url_include Off
  153. php_value variables_order "EGPCS"
  154. php_value default_charset "iso-8859-1"
  155. php_value default_mimetype "text/html"
  156. php_value date.timezone "America/Sao_Paulo"
  157. php_value url_rewriter.tags "a=href,area=href,frame=src,form=,fieldset="
  158. php_value mbstring.func_overload "0"
  159. #php_value mbstring.func_overload "7"
  160. #php_flag mbstring.strict_detection On
  161. php_value max_execution_time 90
  162. php_value max_input_time 120
  163. php_value memory_limit 196M
  164. php_value post_max_size 50M
  165. php_value upload_max_filesize 40M
  166. # Para ambiente de desenvolvimento
  167. #php_flag log_errors On
  168. #php_value error_reporting "E_ALL & ~E_NOTICE"
  169. #php_flag ignore_repeated_errors On
  170. #php_flag report_memleaks On
  171. #php_flag html_errors On
  172. #php_value error_log /tmp/php.log
  173. # deprecate 5.3.0, removed 5.4.0
  174. php_flag magic_quotes_gpc Off
  175. php_flag magic_quotes_runtime Off
  176. php_flag register_globals Off
  177. php_flag register_long_arrays Off
  178. php_flag allow_call_time_pass_reference On
  179. php_flag session.bug_compat_42 0
  180. php_flag session.bug_compat_warn 0
  181. # Habilita a geracao de opcode do APC
  182. php_flag apc.cache_by_default On
  183. </IfModule>