The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Best htaccess code for leverage...
By Guest on 17th July 2018 09:09:13 AM | Syntax: TEXT | Views: 2



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. <IfModule mod_expires.c>
  2.  
  3.     ExpiresActive on
  4.     ExpiresDefault                                      "access plus 1 month"
  5.  
  6.   # CSS
  7.  
  8.     ExpiresByType text/css                              "access plus 1 year"
  9.  
  10.  
  11.   # Data interchange
  12.  
  13.     ExpiresByType application/atom+xml                  "access plus 1 hour"
  14.     ExpiresByType application/rdf+xml                   "access plus 1 hour"
  15.     ExpiresByType application/rss+xml                   "access plus 1 hour"
  16.  
  17.     ExpiresByType application/json                      "access plus 0 seconds"
  18.     ExpiresByType application/ld+json                   "access plus 0 seconds"
  19.     ExpiresByType application/schema+json               "access plus 0 seconds"
  20.     ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
  21.     ExpiresByType application/xml                       "access plus 0 seconds"
  22.     ExpiresByType text/xml                              "access plus 0 seconds"
  23.  
  24.  
  25.   # Favicon (cannot be renamed!) and cursor images
  26.  
  27.     ExpiresByType image/vnd.microsoft.icon              "access plus 1 week"
  28.     ExpiresByType image/x-icon                          "access plus 1 week"
  29.  
  30.   # HTML
  31.     ExpiresByType text/html                             "access plus 0 seconds"
  32.  
  33.  
  34.   # JavaScript
  35.  
  36.     ExpiresByType application/javascript                "access plus 1 year"
  37.     ExpiresByType application/x-javascript              "access plus 1 year"
  38.     ExpiresByType text/javascript                       "access plus 1 year"
  39.  
  40.  
  41.   # Manifest files
  42.  
  43.     ExpiresByType application/manifest+json             "access plus 1 week"
  44.     ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
  45.     ExpiresByType text/cache-manifest                   "access plus 0 seconds"
  46.  
  47.  
  48.   # Media files
  49.  
  50.     ExpiresByType audio/ogg                             "access plus 1 month"
  51.     ExpiresByType image/bmp                             "access plus 1 month"
  52.     ExpiresByType image/gif                             "access plus 1 month"
  53.     ExpiresByType image/jpeg                            "access plus 1 month"
  54.     ExpiresByType image/png                             "access plus 1 month"
  55.     ExpiresByType image/svg+xml                         "access plus 1 month"
  56.     ExpiresByType image/webp                            "access plus 1 month"
  57.     ExpiresByType video/mp4                             "access plus 1 month"
  58.     ExpiresByType video/ogg                             "access plus 1 month"
  59.     ExpiresByType video/webm                            "access plus 1 month"
  60.  
  61.  
  62.   # Web fonts
  63.  
  64.     # Embedded OpenType (EOT)
  65.     ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
  66.     ExpiresByType font/eot                              "access plus 1 month"
  67.  
  68.     # OpenType
  69.     ExpiresByType font/opentype                         "access plus 1 month"
  70.  
  71.     # TrueType
  72.     ExpiresByType application/x-font-ttf                "access plus 1 month"
  73.  
  74.     # Web Open Font Format (WOFF) 1.0
  75.     ExpiresByType application/font-woff                 "access plus 1 month"
  76.     ExpiresByType application/x-font-woff               "access plus 1 month"
  77.     ExpiresByType font/woff                             "access plus 1 month"
  78.  
  79.     # Web Open Font Format (WOFF) 2.0
  80.     ExpiresByType application/font-woff2                "access plus 1 month"
  81.  
  82.  
  83.   # Other
  84.  
  85.     ExpiresByType text/x-cross-domain-policy            "access plus 1 week"
  86.  
  87. </IfModule>
  88.  
  89. <IfModule mod_deflate.c>
  90. # Insert filters / compress text, html, javascript, css, xml:
  91. AddOutputFilterByType DEFLATE text/plain
  92. AddOutputFilterByType DEFLATE text/html
  93. AddOutputFilterByType DEFLATE text/xml
  94. AddOutputFilterByType DEFLATE text/css
  95. AddOutputFilterByType DEFLATE text/vtt
  96. AddOutputFilterByType DEFLATE text/x-component
  97. AddOutputFilterByType DEFLATE application/xml
  98. AddOutputFilterByType DEFLATE application/xhtml+xml
  99. AddOutputFilterByType DEFLATE application/rss+xml
  100. AddOutputFilterByType DEFLATE application/js
  101. AddOutputFilterByType DEFLATE application/javascript
  102. AddOutputFilterByType DEFLATE application/x-javascript
  103. AddOutputFilterByType DEFLATE application/x-httpd-php
  104. AddOutputFilterByType DEFLATE application/x-httpd-fastphp
  105. AddOutputFilterByType DEFLATE application/atom+xml
  106. AddOutputFilterByType DEFLATE application/json
  107. AddOutputFilterByType DEFLATE application/ld+json
  108. AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  109. AddOutputFilterByType DEFLATE application/x-font-ttf
  110. AddOutputFilterByType DEFLATE application/x-web-app-manifest+json
  111. AddOutputFilterByType DEFLATE font/opentype
  112. AddOutputFilterByType DEFLATE image/svg+xml
  113. AddOutputFilterByType DEFLATE image/x-icon
  114.  
  115. # Exception: Images
  116. SetEnvIfNoCase REQUEST_URI \.(?:gif|jpg|jpeg|png|svg)$ no-gzip dont-vary
  117.  
  118. # Drop problematic browsers
  119. BrowserMatch ^Mozilla/4 gzip-only-text/html
  120. BrowserMatch ^Mozilla/4\.0[678] no-gzip
  121. BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  122.  
  123. # Make sure proxies don't deliver the wrong content
  124. Header append Vary User-Agent env=!dont-vary
  125. </IfModule>
  126.  
  127. #Alternative caching using Apache's "mod_headers", if it's installed.
  128. #Caching of common files - ENABLED
  129. <IfModule mod_headers.c>
  130. <FilesMatch "\.(ico|pdf|flv|swf|js|css|gif|png|jpg|jpeg|txt)$">
  131. Header set Cache-Control "max-age=2592000, public"
  132. </FilesMatch>
  133. </IfModule>
  134.  
  135. <IfModule mod_headers.c>
  136.   <FilesMatch "\.(js|css|xml|gz)$">
  137.     Header append Vary Accept-Encoding
  138.   </FilesMatch>
  139. </IfModule>
  140.  
  141. # Set Keep Alive Header
  142. <IfModule mod_headers.c>
  143.     Header set Connection keep-alive
  144. </IfModule>
  145.  
  146. # If your server don't support ETags deactivate with "None" (and remove header)
  147. <IfModule mod_expires.c>
  148.   <IfModule mod_headers.c>
  149.     Header unset ETag
  150.   </IfModule>
  151.   FileETag None
  152. </IfModule>



  • Recent Pastes

Advertise here

Advertise here