You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.htaccess 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. # Force the latest IE version, in various cases when it may fall back to IE7 mode
  2. # github.com/rails/rails/commit/123eb25#commitcomment-118920
  3. # Use ChromeFrame if it's installed for a better experience for the poor IE folk
  4. <IfModule mod_setenvif.c>
  5. <IfModule mod_headers.c>
  6. BrowserMatch MSIE ie
  7. Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
  8. </IfModule>
  9. </IfModule>
  10. # Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
  11. # We need to inform proxies that content changes based on UA
  12. <IfModule mod_headers.c>
  13. Header append Vary User-Agent
  14. </IfModule>
  15. # allow access from all domains for webfonts
  16. # alternatively you could only whitelist
  17. # your subdomains like "sub.domain.com"
  18. <FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
  19. <IfModule mod_headers.c>
  20. Header set Access-Control-Allow-Origin "*"
  21. </IfModule>
  22. </FilesMatch>
  23. # video
  24. AddType video/ogg ogg ogv
  25. AddType video/mp4 mp4
  26. AddType video/webm webm
  27. # Proper svg serving. Required for svg webfonts on iPad
  28. # twitter.com/FontSquirrel/status/14855840545
  29. AddType image/svg+xml svg svgz
  30. AddEncoding gzip svgz
  31. # webfonts
  32. AddType application/vnd.ms-fontobject eot
  33. AddType font/truetype ttf
  34. AddType font/opentype otf
  35. AddType font/woff woff
  36. AddType text/cache-manifest manifest
  37. AddType text/x-component htc
  38. # allow concatenation from within specific js and css files
  39. # e.g. Inside of script.combined.js you could have
  40. # <!--#include file="jquery-1.4.2.js" -->
  41. # <!--#include file="jquery.idletimer.js" -->
  42. # and they would be included into this single file
  43. # this is not in use in the boilerplate as it stands. you may
  44. # choose to name your files in this way for this advantage
  45. # or concatenate and minify them manually.
  46. # Disabled by default.
  47. # <FilesMatch "\.combined\.(js|css)$">
  48. # Options +Includes
  49. # SetOutputFilter INCLUDES
  50. # </FilesMatch>
  51. # gzip compression.
  52. <IfModule mod_deflate.c>
  53. # html, txt, css, js, json, xml, htc:
  54. AddOutputFilterByType DEFLATE text/html text/plain text/css application/x-javascript text/javascript application/javascript application/json text/xml application/xml text/x-component
  55. # webfonts and svg:
  56. <FilesMatch "\.(ttf|otf|eot|svg)$" >
  57. SetOutputFilter DEFLATE
  58. </FilesMatch>
  59. </IfModule>
  60. # these are pretty far-future expires headers
  61. # they assume you control versioning with cachebusting query params like
  62. # <script src="application.js?20100608">
  63. # additionally, consider that outdated proxies may miscache
  64. # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
  65. # if you don't use filenames to version, lower the css and js to something like
  66. # "access plus 1 week" or so
  67. <IfModule mod_expires.c>
  68. Header set cache-control: public
  69. ExpiresActive on
  70. # Perhaps better to whitelist expires rules? Perhaps.
  71. ExpiresDefault "access plus 1 month"
  72. # cache.manifest needs re-reqeusts in FF 3.6 (thx Remy ~Introducing HTML5)
  73. ExpiresByType text/cache-manifest "access plus 0 seconds"
  74. # your document html
  75. ExpiresByType text/html "access plus 0 seconds"
  76. # data
  77. ExpiresByType text/xml "access plus 0 seconds"
  78. ExpiresByType application/xml "access plus 0 seconds"
  79. ExpiresByType application/json "access plus 0 seconds"
  80. # rss feed
  81. ExpiresByType application/rss+xml "access plus 1 hour"
  82. # favicon (cannot be renamed)
  83. ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
  84. # media: images, video, audio
  85. ExpiresByType image/gif "access plus 1 month"
  86. ExpiresByType image/png "access plus 1 month"
  87. ExpiresByType image/jpg "access plus 1 month"
  88. ExpiresByType image/jpeg "access plus 1 month"
  89. ExpiresByType video/ogg "access plus 1 month"
  90. ExpiresByType audio/ogg "access plus 1 month"
  91. ExpiresByType video/mp4 "access plus 1 month"
  92. ExpiresByType video/webm "access plus 1 month"
  93. # webfonts
  94. ExpiresByType font/truetype "access plus 1 month"
  95. ExpiresByType font/opentype "access plus 1 month"
  96. ExpiresByType font/woff "access plus 1 month"
  97. ExpiresByType image/svg+xml "access plus 1 month"
  98. ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  99. # css and javascript
  100. ExpiresByType text/css "access plus 1 month"
  101. ExpiresByType application/javascript "access plus 1 month"
  102. ExpiresByType text/javascript "access plus 1 month"
  103. </IfModule>
  104. # Since we're sending far-future expires, we don't need ETags for
  105. # static content.
  106. # developer.yahoo.com/performance/rules.html#etags
  107. FileETag None
  108. # Allow cookies to be set from iframes (for IE only)
  109. # If needed, uncomment and specify a path or regex in the Location directive
  110. # <IfModule mod_headers.c>
  111. # <Location />
  112. # Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
  113. # </Location>
  114. # </IfModule>
  115. # you probably want www.example.com to forward to example.com -- shorter URLs are sexier.
  116. # no-www.org/faq.php?q=class_b
  117. <IfModule mod_rewrite.c>
  118. Options +FollowSymLinks
  119. RewriteEngine On
  120. RedirectPermanent /index.html /fr.xml
  121. </IfModule>
  122. # without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist (e.g. “/blog/hello”)
  123. # webmasterworld.com/apache/3808792.htm
  124. Options -MultiViews
  125. # -Indexes will have Apache block users from browsing folders without a default document
  126. Options -Indexes
  127. # custom 404 page
  128. ErrorDocument 404 /404.html
  129. # use utf-8 encoding for anything served text/plain or text/html
  130. AddDefaultCharset utf-8
  131. # force utf-8 for a number of file formats
  132. AddCharset utf-8 .html .css .js .xml .json .rss
  133. # We don't need to tell everyone we're apache.
  134. ServerSignature Off