Welcome to the Webmaster Forum.
Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Feb 2015
    Posts
    144

    How to set the caching for javascript/images/css?

    How to set the caching for javascript/images/css?

  2. #2
    Member
    Join Date
    Nov 2015
    Posts
    60

    Re: How to set the caching for javascript/images/css?

    Leverage Browser Caching for Images, CSS and JS

    To leverage your browser's caching generally means that you can specify how long browsers should keep images, CSS and JS stored locally. Of course, if you change any of those, the server will tell the visitor's browser to clear that cache. To enable it, add those lines to your .htaccess file:

    ## EXPIRES CACHING ##
    <IfModule mod_expires.c>
    ExpiresActive On
    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 application/pdf "access 1 month"
    ExpiresByType application/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 2 days"
    </IfModule>
    ## EXPIRES CACHING ##

 

 

Similar Threads

  1. Javascript
    By Michael in forum Web & Graphics Design
    Replies: 18
    Last Post: 11-23-2016, 01:27 AM
  2. How do you resize a javascript banner?
    By kai_uk in forum Coding & Programming
    Replies: 7
    Last Post: 02-18-2016, 02:41 PM
  3. Javascript
    By Realitytvaddict in forum Coding & Programming
    Replies: 21
    Last Post: 01-02-2016, 09:37 PM
  4. javascript and php with curl
    By siec in forum PHP
    Replies: 0
    Last Post: 02-11-2014, 04:46 PM

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
  •  
Back to top

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138