.htaccess 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <IfModule mod_setenvif.c>
  2. <IfModule mod_headers.c>
  3. BrowserMatch MSIE ie
  4. Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
  5. </IfModule>
  6. </IfModule>
  7. <IfModule mod_headers.c>
  8. # Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
  9. # We need to inform proxies that content changes based on UA
  10. Header append Vary User-Agent
  11. # Cache control is set only if mod_headers is enabled, so that's unncessary to declare
  12. </IfModule>
  13. # ----------------------------------------------------------------------
  14. # Webfont access
  15. # ----------------------------------------------------------------------
  16. # allow access from all domains for webfonts
  17. # alternatively you could only whitelist
  18. # your subdomains like "sub.domain.com"
  19. <FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
  20. <IfModule mod_headers.c>
  21. Header set Access-Control-Allow-Origin "*"
  22. </IfModule>
  23. </FilesMatch>
  24. # ----------------------------------------------------------------------
  25. # Proper MIME type for all files
  26. # ----------------------------------------------------------------------
  27. # audio
  28. AddType audio/ogg oga ogg
  29. # video
  30. AddType video/ogg ogv
  31. AddType video/mp4 mp4
  32. AddType video/webm webm
  33. # Proper svg serving. Required for svg webfonts on iPad
  34. # twitter.com/FontSquirrel/status/14855840545
  35. AddType image/svg+xml svg svgz
  36. AddEncoding gzip svgz
  37. # webfonts
  38. AddType application/vnd.ms-fontobject eot
  39. AddType font/truetype ttf
  40. AddType font/opentype otf
  41. AddType application/x-font-woff woff
  42. # assorted types
  43. AddType image/x-icon ico
  44. AddType image/webp webp
  45. AddType text/cache-manifest appcache manifest
  46. AddType text/x-component htc
  47. AddType application/x-chrome-extension crx
  48. AddType application/x-xpinstall xpi
  49. AddType application/octet-stream safariextz
  50. ## # ----------------------------------------------------------------------
  51. ## # Expires headers (for better cache control)
  52. ## # ----------------------------------------------------------------------
  53. ##
  54. ## # these are pretty far-future expires headers
  55. ## # they assume you control versioning with cachebusting query params like
  56. ## # <script src="application.js?20100608">
  57. ## # additionally, consider that outdated proxies may miscache
  58. ## # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
  59. ##
  60. ## # if you don't use filenames to version, lower the css and js to something like
  61. ## # "access plus 1 week" or so
  62. ##
  63. ## <IfModule mod_expires.c>
  64. ## ExpiresActive on
  65. ##
  66. ## # Perhaps better to whitelist expires rules? Perhaps.
  67. ## ExpiresDefault "access plus 1 month"
  68. ##
  69. ## # cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
  70. ## ExpiresByType text/cache-manifest "access plus 0 seconds"
  71. ##
  72. ## # your document html
  73. ## ExpiresByType text/html "access plus 0 seconds"
  74. ##
  75. ## # data
  76. ## ExpiresByType text/xml "access plus 0 seconds"
  77. ## ExpiresByType application/xml "access plus 0 seconds"
  78. ## ExpiresByType application/json "access plus 0 seconds"
  79. ##
  80. ## # rss feed
  81. ## ExpiresByType application/rss+xml "access plus 1 hour"
  82. ##
  83. ## # favicon (cannot be renamed)
  84. ## ExpiresByType image/x-icon "access plus 1 week"
  85. ##
  86. ## # media: images, video, audio
  87. ## ExpiresByType image/gif "access plus 1 month"
  88. ## ExpiresByType image/png "access plus 1 month"
  89. ## ExpiresByType image/jpg "access plus 1 month"
  90. ## ExpiresByType image/jpeg "access plus 1 month"
  91. ## ExpiresByType video/ogg "access plus 1 month"
  92. ## ExpiresByType audio/ogg "access plus 1 month"
  93. ## ExpiresByType video/mp4 "access plus 1 month"
  94. ## ExpiresByType video/webm "access plus 1 month"
  95. ##
  96. ## # htc files (css3pie)
  97. ## ExpiresByType text/x-component "access plus 1 month"
  98. ##
  99. ## # webfonts
  100. ## ExpiresByType font/truetype "access plus 1 month"
  101. ## ExpiresByType font/opentype "access plus 1 month"
  102. ## ExpiresByType application/x-font-woff "access plus 1 month"
  103. ## ExpiresByType image/svg+xml "access plus 1 month"
  104. ## ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  105. ##
  106. ## # css and javascript
  107. ## ExpiresByType text/css "access plus 2 months"
  108. ## ExpiresByType application/javascript "access plus 2 months"
  109. ## ExpiresByType text/javascript "access plus 2 months"
  110. ##
  111. ## <IfModule mod_headers.c>
  112. ## Header append Cache-Control "public"
  113. ## </IfModule>
  114. ##
  115. ## </IfModule>
  116. # ----------------------------------------------------------------------
  117. # ETag removal
  118. # ----------------------------------------------------------------------
  119. # Since we're sending far-future expires, we don't need ETags for
  120. # static content.
  121. # developer.yahoo.com/performance/rules.html#etags
  122. FileETag None
  123. # ----------------------------------------------------------------------
  124. # Start rewrite engine
  125. # ----------------------------------------------------------------------
  126. <IfModule mod_rewrite.c>
  127. RewriteEngine On
  128. </IfModule>
  129. # ----------------------------------------------------------------------
  130. # Suppress or force the "www." at the beginning of URLs
  131. # ----------------------------------------------------------------------
  132. # The same content should never be available under two different URLs - especially not with and
  133. # without "www." at the beginning, since this can cause SEO problems (duplicate content).
  134. # That's why you should choose one of the alternatives and redirect the other one.
  135. # By default option 1 (no "www.") is activated. Remember: Shorter URLs are sexier.
  136. # no-www.org/faq.php?q=class_b
  137. # If you rather want to use option 2, just comment out all option 1 lines
  138. # and uncomment option 2.
  139. # IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
  140. # ----------------------------------------------------------------------
  141. # Option 1:
  142. # Rewrite "www.domain.com -> domain.com"
  143. <IfModule mod_rewrite.c>
  144. RewriteCond %{HTTPS} !=on
  145. RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  146. RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
  147. </IfModule>
  148. # ----------------------------------------------------------------------
  149. # Symfony front controller
  150. # ----------------------------------------------------------------------
  151. <IfModule mod_rewrite.c>
  152. RewriteCond %{REQUEST_FILENAME} !-f
  153. RewriteRule ^(.*)$ app.php [QSA,L]
  154. </IfModule>
  155. # ----------------------------------------------------------------------
  156. # Built-in filename-based cache busting
  157. # ----------------------------------------------------------------------
  158. # If you're not using the build script to manage your filename version revving,
  159. # you might want to consider enabling this, which will route requests for
  160. # /css/all.20110203.css to /res/all.css
  161. # To understand why this is important and a better idea than all.css?v1231,
  162. # read: github.com/paulirish/html5-boilerplate/wiki/Version-Control-with-Cachebusting
  163. # Uncomment to enable.
  164. # <IfModule mod_rewrite.c>
  165. # RewriteCond %{REQUEST_FILENAME} !-f
  166. # RewriteCond %{REQUEST_FILENAME} !-d
  167. # RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
  168. # </IfModule>
  169. # ----------------------------------------------------------------------
  170. # Prevent SSL cert warnings
  171. # ----------------------------------------------------------------------
  172. # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
  173. # https://www.domain.com when your cert only allows https://secure.domain.com
  174. # Uncomment the following lines to use this feature.
  175. # <IfModule mod_rewrite.c>
  176. # RewriteCond %{SERVER_PORT} !^443
  177. # RewriteRule (.*) https://example-domain-please-change-me.com/$1 [R=301,L]
  178. # </IfModule>
  179. # ----------------------------------------------------------------------
  180. # Prevent 404 errors for non-existing redirected folders
  181. # ----------------------------------------------------------------------
  182. # without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist
  183. # e.g. /blog/hello : webmasterworld.com/apache/3808792.htm
  184. Options -MultiViews
  185. # ----------------------------------------------------------------------
  186. # UTF-8 encoding
  187. # ----------------------------------------------------------------------
  188. # use utf-8 encoding for anything served text/plain or text/html
  189. AddDefaultCharset utf-8
  190. # force utf-8 for a number of file formats
  191. AddCharset utf-8 .html .css .js .xml .json .rss