CSS file not working unless I add ?Version=1.0

website link: https://csii.mhsmill.com

My css file, index.css, will not update due to the browser cache unless I add ?Version=1.0 behind the href. I talked with a couple friends, and they said I do not need to add that. Why is it not working without the ?Version=1.0? And yes, I need to change the number (1.0, change it to 1.1, and then 1.2, etc.) which makes it annoying.

The reason this is happening, is because of the browser cache. If I clear the browser cache, it works. But when I change the css after clearing the cache, the new CSS won’t show up. This means that every time I need to look at the new CSS, I need to clear the cache(or use ?Version=1.0+ which is still annoying).

How would I make it so that it works without needing to change the Version number every time?

This sounds like a cache problem:
https://tinkertechlab.com/webhosting/security/how-to-clear-your-browsers-cache

Fix (click):

4 Likes

@wackyblackie, the OP already knows how to clear cache, they want a way to prevent themselves from having to do so.

@LeftClickMage, while you are still in development, try Cloudflare (If you have a custom domain), or .htaccess cache settings:

https://tinkertechlab.com/webhosting/htaccess/set-cache-headers

6 Likes

Hi! Thank you for your reply. I have a custom domain, and I am already using cloudflare. What specifically should I do in cloudflare to fix this? If I use cloudflare, would I still need to upload a .txt file with the code to the htaccess folder?

Hi, I would still like the website to cache (since this improves loading times), but I would like the CSS to also work.

Perfect! Just enable development mode from the homepage (Its in the right sidebar, or at the bottom of on mobile) of your site.

6 Likes

Thank you! This works!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.