Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6188493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:14:28+00:00 2026-05-24T02:14:28+00:00

I want to leverage browser caching to increase page speed. It sounds like max-age

  • 0

I want to leverage browser caching to increase page speed. It sounds like max-age and and last-modified are good choices, but I’m unclear on how to determine which files I should implement for it. In general, I’m confused on how to actually do this and what the code would look like in my htaccess. I guess I’m looking to get some more explicit help or to be shown some examples. Or maybe someone can direct me to a lesson/tutorial on this that a novice like me can understand, which I haven’t had any luck finding. Any help from someone who knows more about max-age and last-modified and can help tell me how to do this would be greatly appreciated. I am really lost on this and would pay someone to help me. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:14:29+00:00Added an answer on May 24, 2026 at 2:14 am

    A search here on SO would have returned some good information – like Leverage browser caching – but anyway…

    From: http://www.samaxes.com/2011/05/improving-web-performance-with-apache-and-htaccess/

    A first-time visitor to your page will make several HTTP requests to download all your sites files, but by using the Expires and Cache-Control headers you make those files cacheable. This avoids unnecessary HTTP requests on subsequent page views.

    Apache enables those headers thanks to mod_expires and mod_headers modules.

    The mod_expires module controls the setting of the Expires HTTP header and the max-age directive of the Cache-Control HTTP header in server responses.

    To modify Cache-Control directives other than max-age, you can use the mod_headers module.

    The mod_headers module provides directives to control and modify HTTP request and response headers. Headers can be merged, replaced or removed.

    Rule for setting Expires headers:

    # BEGIN Expire headers
    <ifModule mod_expires.c>
      ExpiresActive On
      ExpiresDefault "access plus 5 seconds"
      ExpiresByType image/x-icon "access plus 2592000 seconds"
      ExpiresByType image/jpeg "access plus 2592000 seconds"
      ExpiresByType image/png "access plus 2592000 seconds"
      ExpiresByType image/gif "access plus 2592000 seconds"
      ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
      ExpiresByType text/css "access plus 604800 seconds"
      ExpiresByType text/javascript "access plus 216000 seconds"
      ExpiresByType application/javascript "access plus 216000 seconds"
      ExpiresByType application/x-javascript "access plus 216000 seconds"
      ExpiresByType text/html "access plus 600 seconds"
      ExpiresByType application/xhtml+xml "access plus 600 seconds"
    </ifModule>
    # END Expire headers
    

    Rule for setting Cache-Control headers:

    # BEGIN Cache-Control Headers
    <ifModule mod_headers.c>
      <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
        Header set Cache-Control "public"
      </filesMatch>
      <filesMatch "\.(css)$">
        Header set Cache-Control "public"
      </filesMatch>
      <filesMatch "\.(js)$">
        Header set Cache-Control "private"
      </filesMatch>
      <filesMatch "\.(x?html?|php)$">
        Header set Cache-Control "private, must-revalidate"
      </filesMatch>
    </ifModule>
    # END Cache-Control Headers
    

    Note: There is no need to set max-age directive with Cache-Control header since it is already set by mod_expires module.

    must-revalidate means that once a response becomes stale it has to be revalidated; it doesn’t mean that it has to be checked every time.

    More info here: http://www.mnot.net/cache_docs/
    And from Google: http://code.google.com/speed/page-speed/docs/caching.html
    And Yahoo: http://developer.yahoo.com/performance/rules.html#expires

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to leverage the Scala's Actor Framework while I develop the user interface
If I want to work with an object and leverage LINQ to SQL what
want to know why String behaves like value type while using ==. String s1
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
What's a good way to leverage TDD to drive out thread-safe code? For example,
I'd like to leverage the built-in intent chooser to display a custom filtered list
specflow looks like a solution I want my team to consider using. My manager,
I write in-house software for a company. I always want to leverage OOP techniques
I have some utilities and extension methods that I would like to leverage in
when I load a static html page I want to send a JS Object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.