0

I have been getting this weird problem where, when I upload a new CSS file to the public_html folder in cPanel, it is not updating on the website.

Whats really weird about it was that I uploaded the entire website again. Every html file, every folder, everything. And when I checked the CSS file it was the updated version, but the browser was somehow reading the old one.

To fix this issue I had to change the name of the CSS file (in all of the html files too because without it they were still using the old one even tho it was nowhere in the folder) and re upload the whole website again.

So, am I missing something here? Is this supposed to happen? Or is this actually weird and shouldn't happen at all?

Kamila Jarek
  • 103
  • 9
  • 1
    did you reload from cache in the browser? What file were you served when you opened the file directly? Maybe there is an additional caching mechanism on serverside that's giving you an old version. – cloned Mar 31 '20 at 14:18
  • 1
    It is an absolute cache problem. Make sure to clear all cache. If you are using Cloudflare then turn on development mode or if contact your hosting provider to know whether they are using any kind of caching services. – anaszaman Apr 02 '20 at 07:11
  • Does this answer your question? [How do we control web page caching, across all browsers?](https://stackoverflow.com/questions/49547/how-do-we-control-web-page-caching-across-all-browsers) – Martin Oct 28 '20 at 14:06

1 Answers1

1

I've also run into this problem. It seems to be a caching issue. Trying this person's trick is how I narrowed it down to being a caching issue:

https://www.sitepoint.com/community/t/css-html-files-updating-on-cpanel-but-not-on-website/271683/5

Smells like cache to me.

If your recent changes are NOT there, then play a trick on the URL by changing the path a little. For example if the path was /themes/mytheme/assets/custom.css or whatever it is, change the version and do something like /themes/mythemes/assets/custom.css?v=1234567

By changing the URL in this way, it would bypass any kind of cache that would be looking for the previous URL. In other words, you should now see your correct CSS file.

teellis20
  • 11
  • 3
  • This confirms the issue is caching on the client browser and nothing to do with CPanel or server side issues. – Martin Oct 28 '20 at 14:07