Leverage browser caching merupakan masalah yang sering muncul ketika kita mengecek/menganalisa performa website kita dengan GTMETRIX,
Berikut adalah contoh script agar optimasi leverage browser caching dan E-Tag teratasi. Jangan lupa disisipkan pada file .htaccess yang ada di root web directory.
<
FilesMatch
"\.(css|js|htc|CSS|JS|HTC)$">
<
IfModule
mod_headers.c>
Header set Pragma "public"
Header set Cache-Control "public, must-revalidate, proxy-revalidate"
</
IfModule
>
FileETag None //untuk e-tag
</
FilesMatch
>
<
FilesMatch
"\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|
SVGZ|TXT|XSD|XSL|XML)$">
<
IfModule
mod_headers.c>
Header set Pragma "public"
Header set Cache-Control "public, must-revalidate, proxy-revalidate"
</
IfModule
>
FileETag None //untuk e-tag
</
FilesMatch
>
<
FilesMatch
"\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|
gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|
odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|
tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|
AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|MDB|MID|MIDI|
MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|
PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|XLA|
XLS|XLSX|XLT|XLW|ZIP)$">
<
IfModule
mod_headers.c>
Header set Pragma "public"
Header set Cache-Control "public, must-revalidate, proxy-revalidate"
</
IfModule
>
FileETag None //untuk e-tag
</
FilesMatch
>
Jika merasa masih kurang silahkan ditambahi jenis extensionnya.
Selamat mencoba dan terima kasih kunjungannya.