RafaelDeJongh

Swift Performance HTACCESS

Aug 31st, 2017
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.26 KB | None | 0 0
  1. ###BEGIN Swift Performance###
  2. # ------------------------------------------------------------------------------
  3. # | Compression |
  4. # ------------------------------------------------------------------------------
  5. <IfModule mod_deflate.c>
  6.  
  7. # Force compression for mangled headers.
  8. # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
  9. <IfModule mod_setenvif.c>
  10. <IfModule mod_headers.c>
  11. SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
  12. RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
  13. </IfModule>
  14. </IfModule>
  15.  
  16. # Compress all output labeled with one of the following MIME-types
  17. # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
  18. # and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
  19. # as `AddOutputFilterByType` is still in the core directives).
  20. <IfModule mod_filter.c>
  21. AddOutputFilterByType DEFLATE "application/atom+xml" \
  22. "application/javascript" \
  23. "application/json" \
  24. "application/ld+json" \
  25. "application/manifest+json" \
  26. "application/rdf+xml" \
  27. "application/rss+xml" \
  28. "application/schema+json" \
  29. "application/vnd.geo+json" \
  30. "application/vnd.ms-fontobject" \
  31. "application/x-font-ttf" \
  32. "application/x-javascript" \
  33. "application/x-web-app-manifest+json" \
  34. "application/xhtml+xml" \
  35. "application/xml" \
  36. "font/eot" \
  37. "font/opentype" \
  38. "image/bmp" \
  39. "image/svg+xml" \
  40. "image/vnd.microsoft.icon" \
  41. "image/x-icon" \
  42. "text/cache-manifest" \
  43. "text/css" \
  44. "text/html" \
  45. "text/javascript" \
  46. "text/plain" \
  47. "text/vcard" \
  48. "text/vnd.rim.location.xloc" \
  49. "text/vtt" \
  50. "text/x-component" \
  51. "text/x-cross-domain-policy" \
  52. "text/xml"
  53. </IfModule>
  54.  
  55. </IfModule>
  56.  
  57. # ------------------------------------------------------------------------------
  58. # | Expires headers (for better cache control) |
  59. # ------------------------------------------------------------------------------
  60. <IfModule mod_expires.c>
  61. ExpiresActive on
  62. ExpiresDefault "access plus 1 month"
  63.  
  64. # CSS
  65. ExpiresByType text/css "access plus 1 year"
  66.  
  67. # Data interchange
  68. ExpiresByType application/json "access plus 0 seconds"
  69. ExpiresByType application/xml "access plus 0 seconds"
  70. ExpiresByType text/xml "access plus 0 seconds"
  71.  
  72. # Favicon (cannot be renamed!)
  73. ExpiresByType image/x-icon "access plus 1 week"
  74.  
  75. # HTML components (HTCs)
  76. ExpiresByType text/x-component "access plus 1 month"
  77.  
  78. # HTML
  79. ExpiresByType text/html "access plus 0 seconds"
  80.  
  81. # JavaScript
  82. ExpiresByType application/javascript "access plus 1 year"
  83.  
  84. # Manifest files
  85. ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
  86. ExpiresByType text/cache-manifest "access plus 0 seconds"
  87.  
  88. # Media
  89. ExpiresByType audio/ogg "access plus 1 month"
  90. ExpiresByType image/gif "access plus 1 month"
  91. ExpiresByType image/jpeg "access plus 1 month"
  92. ExpiresByType image/png "access plus 1 month"
  93. ExpiresByType video/mp4 "access plus 1 month"
  94. ExpiresByType video/ogg "access plus 1 month"
  95. ExpiresByType video/webm "access plus 1 month"
  96.  
  97. # Web feeds
  98. ExpiresByType application/atom+xml "access plus 1 hour"
  99. ExpiresByType application/rss+xml "access plus 1 hour"
  100.  
  101. # Web fonts
  102. ExpiresByType application/font-woff "access plus 1 month"
  103. ExpiresByType application/font-woff2 "access plus 1 month"
  104. ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  105. ExpiresByType application/x-font-ttf "access plus 1 month"
  106. ExpiresByType font/opentype "access plus 1 month"
  107. ExpiresByType image/svg+xml "access plus 1 month"
  108.  
  109. </IfModule>
  110.  
  111. <IfModule mod_rewrite.c>
  112. RewriteEngine On
  113. RewriteBase /
  114. RewriteCond %{REQUEST_METHOD} !POST
  115. RewriteCond %{QUERY_STRING} ^$
  116. RewriteCond %{HTTP:Cookie} !^.*(wordpress_logged_in).*$
  117. RewriteCond %{REQUEST_URI} !^/wp-content/cache/swift-performance/([^/]*)/assetproxy
  118. RewriteCond /home/harten1q/public_html/wp-content/cache/swift-performance/%{HTTP_HOST}%{REQUEST_URI}/desktop/unauthenticated/index.html -f
  119. RewriteRule (.*) wp-content/cache/swift-performance/%{HTTP_HOST}%{REQUEST_URI}/desktop/unauthenticated/index.html [L]
  120. </IfModule>
  121.  
  122. # ----------------------------------------------------------------------
  123. # CORS-enabled images (@crossorigin)
  124. # ----------------------------------------------------------------------
  125. # Send CORS headers if browsers request them; enabled by default for images.
  126. # developer.mozilla.org/en/CORS_Enabled_Image
  127. # blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
  128. # hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
  129. # wiki.mozilla.org/Security/Reviews/crossoriginAttribute
  130. <IfModule mod_setenvif.c>
  131. <IfModule mod_headers.c>
  132. # mod_headers, y u no match by Content-Type?!
  133. <FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
  134. SetEnvIf Origin ":" IS_CORS
  135. Header set Access-Control-Allow-Origin "*" env=IS_CORS
  136. </FilesMatch>
  137. </IfModule>
  138. </IfModule>
  139. # ----------------------------------------------------------------------
  140. # Webfont access
  141. # ----------------------------------------------------------------------
  142. # Allow access from all domains for webfonts.
  143. # Alternatively you could only whitelist your
  144. # subdomains like "subdomain.example.com".
  145. <IfModule mod_headers.c>
  146. <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
  147. Header set Access-Control-Allow-Origin "*"
  148. </FilesMatch>
  149. </IfModule>
  150.  
  151. ###END Swift Performance###
Advertisement
Add Comment
Please, Sign In to add comment