exclamation-circle Joomla Performance: Specify a Cache Validator

Topic Rating


07 Nov 2017 01:25 #1 by Trony

  • Administrator
  • Administrator
  • Location: Roma
  • Time Zone: UTC +2:00
  • Local Time: 11:13

  • Posts: 939
  • Profile views: 3260
  • Thank you received: 8

  • Register Date: 01 Jul 2008
  • Last login: 22 Sep 2021 22:50
  • Joomla Performance: Specify a Cache Validator was created by Trony



    If You test your Website with a tools like GTmetrix , You could find a suggestion like Specify a cache validator:

    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


    First Step


    Check in your htaccess if You have these rules:
    FileETag None
    Header unset ETag
    Header unset Last-Modified

    I suggest to comment with # and put FileETag MTime Size:
    FileETag MTime Size
    #FileETag None
    #Header unset ETag
    #Header unset Last-Modified

    Second Step


    Sometimes Joomla did not ETag header and so, You Edit index.php of Your Template and You put at top this PHP's Code:
    <?php
    $etagFuso= md5_file($_SERVER['SCRIPT_FILENAME']);
    header('ETag: '. 'W/"'.$etagFuso.'"', true );
    ?>
    I prefer to use Weak ETag Validation instead Strong.
    You can read more here: Strong and Weak validation

    Conclusions


    You can to use only Last Modified Header but ETag is more Compatible with some Browsers and Bots (Bing for Example).
    Music and Electronic Devices Designer. Drum and Bass Addict. Creative Mind as Lifestyle. Cat in past Life. Soccer, Ice Hockey and Snowboard Lover. Marxist.
    Sono Il Re sul Carro Danzante. Attraversando La Città Getto Via I Coriandoli Della Vostra Tristezza Regalando Passione Ed Estasi Nei Vostri Occhi.
    Follow Trony on: FusoElektronique | Facebook | Twitter | Soundcloud

    Please Log in or Create an account to join the conversation.

    Moderators: Trony

    You might also be interested...

    FusoElektronique - Pure Electronic Music.

    Community and Web Radio of Electronic Music since July 2008. Rome, Italy

    Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) 2021.

    About us | Our team | Cookie Policy | Privacy Policy | Terms and Conditions | Contact us | Sitemap