Posted - 05/02/2022 : 15:28:42
quote: I'm no server boffin & if any of the more knowledgeable people regarding htaccess rules see anything adrift please pipe up.
Well, since you asked, I wouldn't do any of that. Trying to prevent css and javascript being cached in the browser might be convenient for your occasional updates but downloading all that content for every page load is going to hurt your performance, you want stuff to be cached for a really long time if it hasn't changed. Instead, do this: In your document head you'll have a couple of lines where ectcart.css and ectcart.jss are called. Append a query string to them with a unique number (or anything, really) like this (add the part in red): <link rel="stylesheet" href="css/ectcart.css?ver=1"> <script src="js/ectcart.js?ver=1"></script> and then increment that number whenever you update the site. The next time the page is fetched the browser will look for the new version instead of relying on cached data. On a Unix/Linux server, you can also automate that with something like this: <link rel="stylesheet" href="css/ectcart.css?ver=<?php echo filemtime('css/ectcart.css'); ?>"> <script src="js/ectcart.js?ver=<?php echo filemtime('js/ectcart.js'); ?>"></script> which will print the Unix timestamp of when the file was last modified. Update the file and the timestamp will change, forcing the browser to fetch a fresh copy. Peter Professional ecommerce web hosting services Shared hosting Windows & Linux | Dedicated servers | Domains | SSL Ecommerce Templates specialists since 2003 https://servelink.com
|