Advertisement
salmancreation

Speed Up WordPress through .htaccess

Apr 6th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.39 KB | None | 0 0
  1. Header unset ETag  
  2. FileETag None
  3.  
  4. # BEGIN Expire headers  
  5. <ifModule mod_expires.c>  
  6.     ExpiresActive On  
  7.     ExpiresDefault "access plus 2592000 seconds"  
  8.     ExpiresByType image/x-icon "access plus 2592000 seconds"  
  9.     ExpiresByType image/jpeg "access plus 2592000 seconds"  
  10.     ExpiresByType image/png "access plus 2592000 seconds"  
  11.     ExpiresByType image/gif "access plus 2592000 seconds"  
  12.     ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"  
  13.     ExpiresByType text/css "access plus 604800 seconds"  
  14.     ExpiresByType text/javascript "access plus 216000 seconds"  
  15.     ExpiresByType application/javascript "access plus 216000 seconds"  
  16.     ExpiresByType application/x-javascript "access plus 216000 seconds"  
  17.     ExpiresByType application/xhtml+xml "access plus 600 seconds"
  18.     ExpiresByType text/html "access plus 1 day"
  19. </ifModule>  
  20. # END Expire headers
  21.  
  22. # BEGIN Cache-Control Headers  
  23. <ifModule mod_headers.c>  
  24.     <filesMatch "\.(ico|jpe?g|png|gif|swf)$">  
  25.         Header set Cache-Control "public"  
  26.     </filesMatch>  
  27.     <filesMatch "\.(css)$">  
  28.         Header set Cache-Control "public"  
  29.     </filesMatch>  
  30.     <filesMatch "\.(js)$">  
  31.         Header set Cache-Control "private"  
  32.     </filesMatch>  
  33.     <filesMatch "\.(x?html?|php)$">  
  34.         Header set Cache-Control "private, must-revalidate"  
  35.     </filesMatch>  
  36. </ifModule>  
  37. # END Cache-Control Headers
  38.  
  39. # BEGIN GZIP (May not work on all servers)
  40. # mod_gzip compression (legacy, Apache 1.3)
  41. <IfModule mod_gzip.c>
  42. mod_gzip_on Yes
  43. mod_gzip_dechunk Yes
  44. mod_gzip_item_include file \.(html?|xml|txt|css|js)$
  45. mod_gzip_item_include handler ^cgi-script$
  46. mod_gzip_item_include mime ^text/.*
  47. mod_gzip_item_include mime ^application/x-javascript.*
  48. mod_gzip_item_exclude mime ^image/.*
  49. mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  50. </IfModule>
  51. # END GZIP
  52.  
  53. # DEFLATE compression
  54. <IfModule mod_deflate.c>
  55. # Set compression for: html,txt,xml,js,css
  56. AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
  57. # Deactivate compression for buggy browsers
  58. BrowserMatch ^Mozilla/4 gzip-only-text/html
  59. BrowserMatch ^Mozilla/4.0[678] no-gzip
  60. BrowserMatch bMSIE !no-gzip !gzip-only-text/html
  61. # Set header information for proxies
  62. Header append Vary User-Agent
  63. </IfModule>
  64. # END DEFLATE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement