inovve

htaccess wordpress speedup

Mar 21st, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1. # BEGIN DEFLATE COMPRESSION
  2. <IfModule mod_deflate.c>
  3. # Compress HTML, CSS, JavaScript, Text, XML and fonts
  4. AddOutputFilterByType DEFLATE application/javascript
  5. AddOutputFilterByType DEFLATE application/rss+xml
  6. AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  7. AddOutputFilterByType DEFLATE application/x-font
  8. AddOutputFilterByType DEFLATE application/x-font-opentype
  9. AddOutputFilterByType DEFLATE application/x-font-otf
  10. AddOutputFilterByType DEFLATE application/x-font-truetype
  11. AddOutputFilterByType DEFLATE application/x-font-ttf
  12. AddOutputFilterByType DEFLATE application/x-javascript
  13. AddOutputFilterByType DEFLATE application/xhtml+xml
  14. AddOutputFilterByType DEFLATE application/xml
  15. AddOutputFilterByType DEFLATE font/opentype
  16. AddOutputFilterByType DEFLATE font/otf
  17. AddOutputFilterByType DEFLATE font/ttf
  18. AddOutputFilterByType DEFLATE image/svg+xml
  19. AddOutputFilterByType DEFLATE image/x-icon
  20. AddOutputFilterByType DEFLATE text/css
  21. AddOutputFilterByType DEFLATE text/html
  22. AddOutputFilterByType DEFLATE text/javascript
  23. AddOutputFilterByType DEFLATE text/plain
  24. AddOutputFilterByType DEFLATE text/xml
  25. </IfModule>
  26. # END DEFLATE COMPRESSION
  27.  
  28. # BEGIN GZIP COMPRESSION
  29. <IfModule mod_gzip.c>
  30. mod_gzip_on Yes
  31. mod_gzip_dechunk Yes
  32. mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  33. mod_gzip_item_include handler ^cgi-script$
  34. mod_gzip_item_include mime ^text/.*
  35. mod_gzip_item_include mime ^application/x-javascript.*
  36. mod_gzip_item_exclude mime ^image/.*
  37. mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  38. </IfModule>
  39. # END GZIP COMPRESSION
  40.  
  41. #BEGIN EXPIRES HEADERS
  42. <IfModule mod_expires.c>
  43. # Enable expirations
  44. ExpiresActive On
  45. # Default expiration: 1 hour after request
  46. ExpiresDefault "now plus 1 hour"
  47. # CSS and JS expiration: 1 week after request
  48. ExpiresByType text/css "now plus 1 week"
  49. ExpiresByType application/javascript "now plus 1 week"
  50. ExpiresByType application/x-javascript "now plus 1 week"
  51. # Image files expiration: 1 month after request
  52. ExpiresByType image/bmp "now plus 1 month"
  53. ExpiresByType image/gif "now plus 1 month"
  54. ExpiresByType image/jpeg "now plus 1 month"
  55. ExpiresByType image/jp2 "now plus 1 month"
  56. ExpiresByType image/pipeg "now plus 1 month"
  57. ExpiresByType image/png "now plus 1 month"
  58. ExpiresByType image/svg+xml "now plus 1 month"
  59. ExpiresByType image/tiff "now plus 1 month"
  60. ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
  61. ExpiresByType image/x-icon "now plus 1 month"
  62. ExpiresByType image/ico "now plus 1 month"
  63. ExpiresByType image/icon "now plus 1 month"
  64. ExpiresByType text/ico "now plus 1 month"
  65. ExpiresByType application/ico "now plus 1 month"
  66. # Webfonts
  67. ExpiresByType font/truetype "access plus 1 month"
  68. ExpiresByType font/opentype "access plus 1 month"
  69. ExpiresByType application/x-font-woff "access plus 1 month"
  70. ExpiresByType image/svg+xml "access plus 1 month"
  71. ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  72. </IfModule>
  73. #END EXPIRES HEADERS
  74.  
  75. # BEGIN Cache-Control Headers
  76. <ifModule mod_headers.c>
  77. <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
  78. Header set Cache-Control "public"
  79. </filesMatch>
  80. <filesMatch "\.(css)$">
  81. Header set Cache-Control "public"
  82. </filesMatch>
  83. <filesMatch "\.(js)$">
  84. Header set Cache-Control "private"
  85. </filesMatch>
  86. <filesMatch "\.(x?html?|php)$">
  87. Header set Cache-Control "private, must-revalidate"
  88. </filesMatch>
  89. </ifModule>
  90. # END Cache-Control Headers
  91.  
  92. # BEGIN Cache-Control Headers
  93. <ifModule mod_headers.c>
  94. <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
  95. Header set Cache-Control "max-age=2592000, public"
  96. </filesMatch>
  97. <filesMatch "\.(css)$">
  98. Header set Cache-Control "max-age=604800, public"
  99. </filesMatch>
  100. <filesMatch "\.(js)$">
  101. Header set Cache-Control "max-age=216000, private"
  102. </filesMatch>
  103. <filesMatch "\.(x?html?|php)$">
  104. Header set Cache-Control "max-age=600, private, must-revalidate"
  105. </filesMatch>
  106. </ifModule>
  107. # END Cache-Control Headers
  108.  
  109. # BEGIN WordPress
  110. <IfModule mod_rewrite.c>
  111. RewriteEngine On
  112. RewriteBase /
  113. RewriteRule ^index\.php$ - [L]
  114. RewriteCond %{REQUEST_FILENAME} !-f
  115. RewriteCond %{REQUEST_FILENAME} !-d
  116. RewriteRule . /index.php [L]
  117. </IfModule>
  118.  
  119. # END WordPress
  120.  
  121. # TN START ENABLE KEEP ALIVE
  122. <ifModule mod_headers.c>
  123. Header set Connection keep-alive
  124. </ifModule>
  125. # TN END ENABLE KEEP ALIVE
Advertisement
Add Comment
Please, Sign In to add comment