RafaelDeJongh

WP Rocket HTACCESSS

May 6th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.75 KB | None | 0 0
  1. # BEGIN WP Rocket v2.9.8.1
  2. # Use UTF-8 encoding for anything served text/plain or text/html
  3. AddDefaultCharset UTF-8
  4. # Force UTF-8 for a number of file formats
  5. <IfModule mod_mime.c>
  6. AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
  7. </IfModule>
  8.  
  9. # FileETag None is not enough for every server.
  10. <IfModule mod_headers.c>
  11. Header unset ETag
  12. </IfModule>
  13.  
  14. # Since we’re sending far-future expires, we don’t need ETags for static content.
  15. # developer.yahoo.com/performance/rules.html#etags
  16. FileETag None
  17.  
  18. <IfModule mod_alias.c>
  19. <FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$">
  20. <IfModule mod_headers.c>
  21. Header set X-Powered-By "WP Rocket/2.9.8.1"
  22. Header unset Pragma
  23. Header append Cache-Control "public"
  24. Header unset Last-Modified
  25. </IfModule>
  26. </FilesMatch>
  27.  
  28. <FilesMatch "\.(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
  29. <IfModule mod_headers.c>
  30. Header unset Pragma
  31. Header append Cache-Control "public"
  32. </IfModule>
  33. </FilesMatch>
  34. </IfModule>
  35.  
  36. # Expires headers (for better cache control)
  37. <IfModule mod_expires.c>
  38. ExpiresActive on
  39.  
  40. # Perhaps better to whitelist expires rules? Perhaps.
  41. ExpiresDefault "access plus 1 month"
  42.  
  43. # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
  44. ExpiresByType text/cache-manifest "access plus 0 seconds"
  45.  
  46. # Your document html
  47. ExpiresByType text/html "access plus 0 seconds"
  48.  
  49. # Data
  50. ExpiresByType text/xml "access plus 0 seconds"
  51. ExpiresByType application/xml "access plus 0 seconds"
  52. ExpiresByType application/json "access plus 0 seconds"
  53.  
  54. # Feed
  55. ExpiresByType application/rss+xml "access plus 1 hour"
  56. ExpiresByType application/atom+xml "access plus 1 hour"
  57.  
  58. # Favicon (cannot be renamed)
  59. ExpiresByType image/x-icon "access plus 1 week"
  60.  
  61. # Media: images, video, audio
  62. ExpiresByType image/gif "access plus 1 month"
  63. ExpiresByType image/png "access plus 1 month"
  64. ExpiresByType image/jpeg "access plus 1 month"
  65. ExpiresByType video/ogg "access plus 1 month"
  66. ExpiresByType audio/ogg "access plus 1 month"
  67. ExpiresByType video/mp4 "access plus 1 month"
  68. ExpiresByType video/webm "access plus 1 month"
  69.  
  70. # HTC files (css3pie)
  71. ExpiresByType text/x-component "access plus 1 month"
  72.  
  73. # Webfonts
  74. ExpiresByType application/x-font-ttf "access plus 1 month"
  75. ExpiresByType font/opentype "access plus 1 month"
  76. ExpiresByType application/x-font-woff "access plus 1 month"
  77. ExpiresByType application/x-font-woff2 "access plus 1 month"
  78. ExpiresByType image/svg+xml "access plus 1 month"
  79. ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  80.  
  81. # CSS and JavaScript
  82. ExpiresByType text/css "access plus 1 year"
  83. ExpiresByType application/javascript "access plus 1 year"
  84.  
  85. </IfModule>
  86.  
  87. # Gzip compression
  88. <IfModule mod_deflate.c>
  89. # Active compression
  90. SetOutputFilter DEFLATE
  91. # Force deflate for mangled headers
  92. <IfModule mod_setenvif.c>
  93. <IfModule mod_headers.c>
  94. SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
  95. RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
  96. # Don’t compress images and other uncompressible content
  97. SetEnvIfNoCase Request_URI \
  98. \.(?:gif|jpe?g|png|rar|zip|exe|flv|mov|wma|mp3|avi|swf|mp?g|mp4|webm|webp)$ no-gzip dont-vary
  99. </IfModule>
  100. </IfModule>
  101.  
  102. # Compress all output labeled with one of the following MIME-types
  103. <IfModule mod_filter.c>
  104. AddOutputFilterByType DEFLATE application/atom+xml \
  105.  
  106. application/javascript \
  107.  
  108. application/json \
  109.  
  110. application/rss+xml \
  111.  
  112. application/vnd.ms-fontobject \
  113.  
  114. application/x-font-ttf \
  115.  
  116. application/xhtml+xml \
  117.  
  118. application/xml \
  119.  
  120. font/opentype \
  121.  
  122. image/svg+xml \
  123.  
  124. image/x-icon \
  125.  
  126. text/css \
  127.  
  128. text/html \
  129.  
  130. text/plain \
  131.  
  132. text/x-component \
  133.  
  134. text/xml
  135. </IfModule>
  136. <IfModule mod_headers.c>
  137. Header append Vary: Accept-Encoding
  138. </IfModule>
  139. </IfModule>
  140.  
  141. <IfModule mod_mime.c>
  142. AddType text/html .html_gzip
  143. AddEncoding gzip .html_gzip
  144. </IfModule>
  145. <IfModule mod_setenvif.c>
  146. SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip
  147. </IfModule>
  148.  
  149. <IfModule mod_rewrite.c>
  150. RewriteEngine On
  151. RewriteBase /
  152. RewriteCond %{HTTPS} on [OR]
  153. RewriteCond %{SERVER_PORT} ^443$ [OR]
  154. RewriteCond %{HTTP:X-Forwarded-Proto} https
  155. RewriteRule .* - [E=WPR_SSL:-https]
  156. RewriteCond %{HTTP:Accept-Encoding} gzip
  157. RewriteRule .* - [E=WPR_ENC:_gzip]
  158. RewriteCond %{REQUEST_METHOD} GET
  159. RewriteCond %{QUERY_STRING} =""
  160. RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC]
  161. RewriteCond %{REQUEST_URI} !^(/wp-json/(.*))$ [NC]
  162. RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC]
  163. RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}.html%{ENV:WPR_ENC}" -f
  164. RewriteRule .* "/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}.html%{ENV:WPR_ENC}" [L]
  165. </IfModule>
  166. # END WP Rocket
Advertisement
Add Comment
Please, Sign In to add comment