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 BlaB! AX Maintenance Mode How to Log in to BlaB! AX 6 Ways to Improve Website Accessibility How to Create HTML Pages with the CherryTree Note-Taking Application Connecting with Google Analytics in Jetpack Search Engine Optimization with Jetpack Professional FlatPress Themes and Styles How to Manage User Account Settings in OctoberCMS Force HTTPS in OctoberCMS with RedirectToHTTPS How to Uninstall Plugins in OctoberCMS