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

  • Home
  • SEARCH
  • 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 6161315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:27:29+00:00 2026-05-23T21:27:29+00:00

Can someone provide me with an optimized .htaccess configuration that handles compression, browser caching,

  • 0

Can someone provide me with an optimized .htaccess configuration that handles compression, browser caching, proxy caching, etc. for a typical website?

Aside from my visitors, I’m also trying to make Google PageSpeed happy.
I wanna use caching and gzip compression through .htaccess please help me with its code!

I want to cache icon,pdf,flv,jpg,png,gif,js,css,swf files for long time

I want to cache xml,txt files for 2 Days

I want to cache html files for 2 Days

And I wanna compress my html,txt,css,js,php files because those have large file size.

Is there any way to gzip images using .htaccess?

  • 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-23T21:27:29+00:00Added an answer on May 23, 2026 at 9:27 pm
    # 480 weeks
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=290304000, public"
    </FilesMatch>
    
    # 2 DAYS
    <FilesMatch "\.(xml|txt)$">
    Header set Cache-Control "max-age=172800, public, must-revalidate"
    </FilesMatch>
    
    # 2 HOURS
    <FilesMatch "\.(html|htm)$">
    Header set Cache-Control "max-age=7200, must-revalidate"
    </FilesMatch>
    
    <ifModule mod_gzip.c>
      mod_gzip_on Yes
      mod_gzip_dechunk Yes
      mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
      mod_gzip_item_include handler ^cgi-script$
      mod_gzip_item_include mime ^text/.*
      mod_gzip_item_include mime ^application/x-javascript.*
      mod_gzip_item_exclude mime ^image/.*
      mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    </ifModule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone provide me with an optimize .htaccess configuration that handles compression, browser caching,
Can someone provide the XML configuration I should use with Microsoft Unity application block
My regex skills are a bit rusty. Can someone provide a expression that I
Can someone provide a link to a document that has all HTML (preferably HTML5)
Can someone provide a regex that only allows digits and optionally hyphens I have
Can someone provide me a regex for SSN that matches either 123-45-6789 OR XXX-XX-XXXX
Can someone provide a regular expression for parsing name/value pairs from a string? The
Can someone provide a simple explanation of methods vs. functions in OOP context?
Can someone provide the download link for SQL Server Reports add-in for Visual Studio
Can someone provide some light on how to do this? I can do this

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.