How to Set Up Non-cached Pages with .htaccess Updated on August 16, 2021 by Christopher Maiorana 1 Minutes, 27 Seconds to Read Cache control is one of the primary system administrative tasks you will find yourself performing. Thankfully, most browsers will take care of at least some of the caching for you, remembering certain resources that were loaded before. However, there may be occasions in which browser caching is something you don’t want. In this article, we’ll show you how to set up non-cache pages with .htaccess. For example, if you’re developing a site in a test environment and making constant changes, cached resources will likely interfere with changes you’re making. You may find yourself constantly clearing your browser cache to see the effect of your work. Or, imagine you have a static page that is updated frequently, like a client roster, or an organizational document. In cases like the latter, it would not be convenient for your visitors to constantly clear their browser caches or risk missing out on new information. Set up non-cached pages with .htaccess Using your favorite file management method, open your .htaccess file for editing Option tip: using SSH, you can use an editor command like nano .htaccess to use the nano text editor Place this code into your .htaccess file: <filesMatch "\.(html|htm|js|css)$"> FileETag None <ifModule mod_headers.c> Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" </ifModule> </filesMatch> Remember that this .htaccess file will act recursively upon all files within the document path that follows. So it would be best to separate this path from any resources you want to cache. For example, a subdomain would be a great place to put this code in order to set up non-cache pages with .htaccess. Share this Article CM Christopher Maiorana Content Writer II Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog. More Articles by Christopher Related Articles What Is SSL and Why Does It Matter for Your Website? How to Tell If a Website Is Secure: 2026 Browser Guide How to Enable cPanel AutoSSL via Account Management Panel (AMP) and WHM How to Manage AutoSSL Certificates in cPanel How to Run and Read a Traceroute: Troubleshooting Website Connectivity What Are Meta Tags? Guide to SEO Meta Tags & Best Practices Meta Descriptions and SEO Install Let’s Encrypt Free SSL Certificate on Ubuntu with Certbot How to Set Up a 301 Permanent Redirect via .htaccess & cPanel BlaB! AX Maintenance Mode