Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1

    Default how to use Specify a cache validator the bmz_cache iamges and js,css in template

    Hello.all,you can see my Report https://gtmetrix.com/reports/targetmarts.com/6QMWojJv
    it display many images,js,css are missing a cache validator.
    SO i ask to use Specify a cache validator.

    Now i host in godaddy,php 7.0.27 (Zend: 3.0.0),used IH5 ,and some template images define in php files.

    the .htaccess in root as below now:
    PHP Code:
    ##  Header Settings

    <IfModule mod_headers.c>
    # Set the default language of your site
      
    Header set Content-Language "en-us"

      
    Header unset Pragma
      FileETag None
      Header 
    unset ETag
      
    #Header set Cache-Control "no-transform"
      
    <FilesMatch "(?i).*\.(ico|jpe?g|gif|webp|png|otf|swf|flv|ttf|woff|eot|svg)$">
        
    Header set Cache-control "max-age=864000, public, must-revalidate"
        
    Header unset Last-Modified
      
    </FilesMatch>
      <
    FilesMatch "(?i).*\.(html|htm|xml|txt|xsl)$">
        
    Header set Cache-control "max-age=7200, must-revalidate"
      
    </FilesMatch>

    # Ensure the most current site files are being provided
      
    Header set Cache-Control "proxy-revalidate, stale-while-revalidate=86400, stale-if-error=259200"

    # Prevents seeing information not needed to see
      
    Header unset X-Powered-By

    # Protection against PHP or Javascript code placed within images and other misinterpretations of your resources.
      
    Header set X-Content-Type-Options "nosniff"

    # Protection against Clickjacking
      
    Header set X-Frame-Options "SameOrigin"

    # Protection against XSS (Cross-Site Scripting)
      
    Header set X-XSS-Protection "1; mode=block"

    # Protection against abuse of Adobe Flash / Silverlight / PDF files
      
    Header set X-Permitted-Cross-Domain-Policies "Master-Only"
    </IfModule>


    #############################
    ##  EXPIRES CACHING

    # Note: You cannot set expires headers for files or content you are loading from a different site.

    <IfModule mod_expires.c>
      
    ExpiresActive On
      ExpiresDefault 
    "access plus 1 day"

      
    ExpiresByType application/javascript         "access plus 1 month"
      
    ExpiresByType application/pdf                "access plus 1 month"
      
    ExpiresByType application/x-shockwave-flash  "access plus 1 month"
      
    ExpiresByType image/jpg                      "access plus 1 year"
      
    ExpiresByType image/jpeg                     "access plus 1 year"
      
    ExpiresByType image/gif                      "access plus 1 year"
      
    ExpiresByType image/png                      "access plus 1 year"
      
    ExpiresByType image/x-icon                   "access plus 1 year"
      
    ExpiresByType image/webp                     "access plus 1 year"
      
    ExpiresByType text/css                       "access plus 1 month"
      
    ExpiresByType text/x-javascript              "access plus 1 month"

      
    # Embedded OpenType (EOT)
      
    ExpiresByType application/vnd.ms-fontobject  "access plus 1 month"
      
    ExpiresByType font/eot                       "access plus 1 month"

      
    # OpenType
      
    ExpiresByType font/opentype                  "access plus 1 month"

      
    # TrueType
      
    ExpiresByType application/x-font-ttf         "access plus 1 month"

      
    # Web Open Font Format (WOFF) 1.0
      
    ExpiresByType application/font-woff          "access plus 1 month"
      
    ExpiresByType application/x-font-woff        "access plus 1 month"
      
    ExpiresByType font/woff                      "access plus 1 month"

      
    # Web Open Font Format (WOFF) 2.0
      
    ExpiresByType application/font-woff2         "access plus 1 month"
    </IfModule
    in bmz_cache as below now:
    PHP Code:
    <IfModule mod_headers.c>
      
    Header unset Pragma
      FileETag None
      Header 
    unset ETag
      
    #Header set Cache-Control "no-transform"
      
    <FilesMatch "(?i).*\.(ico|jpe?g|gif|webp|png|otf|swf|flv|ttf|woff|eot|svg)$">
        
    Header set Cache-control "max-age=864000, public, must-revalidate"
        
    Header unset Last-Modified
      
    </FilesMatch>
      <
    FilesMatch "(?i).*\.(html|htm|xml|txt|xsl)$">
        
    Header set Cache-control "max-age=7200, must-revalidate"
      
    </FilesMatch>
    </
    IfModule>
    <
    ifmodule mod_expires.c>
    ExpiresActive On
      ExpiresByType image
    /x-icon A86400
      ExpiresByType image
    /jpeg A2592000
      ExpiresByType image
    /png A2592000
      ExpiresByType image
    /gif A604800
    ExpiresDefault 
    "access plus 15 days"
    ExpiresByType image/gif "access plus 15 days"
    ExpiresByType image/png "access plus 15 days"
    ExpiresByType image/jpg "access plus 15 days"
    </ifmodule
    so please help me to fix this .
    Thanks

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    Are you sure that your site's Apache configuration includes mod_headers.c and mod_expires.c? Apache directives flow "downhill" so the root directives would apply to the /bmz_cache, too.

    If you do include that .htaccess in the /bmz_cache directory, the only file-types that will be present there (and valid for download) are .jpg, .jpeg, .png and .gif.

  3. #3
    Join Date
    Feb 2009
    Location
    atlanta GA
    Posts
    278
    Plugin Contributions
    0

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    So did you ever figure this out ?

    https://gtmetrix.com/reports/www.mis...d.com/RJRPTzLs

    Is my scoreing

    shows me as having the same issue with Specifying a cache validator but i for the life of me can't figure out where to change that ? Do i need to add something to the .htaccess file in root ?

  4. #4

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    Ok,i fixed it:
    make the htaccess file to
    root/
    images/
    includes/
    includes/..
    etc


    PHP Code:
    Header unset Pragma
    FileETag None
    Header 
    unset ETag
    <IfModule pagespeed_module>
    ModPagespeed on
    # using commands,filters etc
    </IfModule>


    <
    FilesMatch "(?i).*\.(js|css|html?|ico|jpe?g|gif|webp|png|swf|flv|xml|xsl|otf|ttf|woff|eot|svg|map)$">
      <
    IfModule mod_authz_core.c>
        Require 
    all granted
      
    </IfModule>
      <
    IfModule !mod_authz_core.c>
        
    Order Allow,Deny
        Allow from all
      
    </IfModule>
    </
    FilesMatch>
    <
    IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text
    /x-javascript "access plus 1 month"  
    ExpiresByType application/javascript "access plus 1 month"  
    ExpiresByType application/x-javascript "access plus 1 month"
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/html "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 2 month"
    </IfModule

  5. #5
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    231
    Plugin Contributions
    0

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    Just to clarify, you're saying you copied that same .htacess into all those folders, correct?

    By looking at your report, I also noticed you don't get the warning about using a cookie-free domain for images, yet it seems you use the same domain for your images.

    How did you fix that? I get this warning, but did not think there was an easy fix apart from moving all the images to a subdomain...

  6. #6
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    231
    Plugin Contributions
    0

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    Anyone?

  7. #7
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    231
    Plugin Contributions
    0

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    These are the ones I don't seem to be able to fix:
    The following resources are missing a cache validator. Resources that do not specify a cache validator cannot be refreshed efficiently. Specify a Last-Modified or ETag header to enable cache validation for the following resources:
    https://tabletennisshop.com.au/inclu...ages/logo3.jpg
    https://tabletennisshop.com.au/inclu...-ttsa-logo.png
    https://tabletennisshop.com.au/inclu...es/stars_4.png
    https://www.googletagmanager.com/gta...=UA-24411702-1
    I've tried putting the same .htaccess in that folder, but it won't go away.

    I know this can be fixed by hosting the images in another domain. However I've seen several people with shops on this forum, who don't get this warning, yet when I check the location of their images, it's hosted on the same domain as the shop. So how did they fix it? Is there something you can out in the .htaccess that stops the cookies from being sent?

  8. #8
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    231
    Plugin Contributions
    0

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    Anyone?

  9. #9
    Join Date
    Aug 2010
    Location
    Israel
    Posts
    285
    Plugin Contributions
    0

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    Quote Originally Posted by ttfan View Post
    These are the ones I don't seem to be able to fix:

    I've tried putting the same .htaccess in that folder, but it won't go away.
    Add these lines to the .htaccess file which is inside the /includes/ directory:

    Code:
    ## EXPIRES CACHING##
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType application/javascript "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType text/x-javascript "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresDefault "access plus 2 days"
    </IfModule>
    ## EXPIRES CACHING##
    and it will solve your problem of the css / js files expiry.

  10. #10
    Join Date
    Aug 2010
    Location
    Israel
    Posts
    285
    Plugin Contributions
    0

    Default Re: how to use Specify a cache validator the bmz_cache iamges and js,css in template

    By the way, my site's Apache configuration includes mod_headers.c and mod_expires.c
    but still I was needed to make the above.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. How do I use my own CSS template?
    By hhalliburton in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 30 Jul 2009, 01:39 PM
  2. How to use the fix cache key Utility?
    By philip56 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 1 Nov 2008, 09:01 PM
  3. CSS Validator issue - Peek-a-boo? Template Monster template
    By Mickmo68 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 14 May 2008, 02:51 AM
  4. Replies: 2
    Last Post: 3 Mar 2008, 07:29 PM
  5. how can I change the banner image to my own iamges?
    By lina0962 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 11 Jun 2006, 05:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR