Page is caching info

My website URL is:
What I’m seeing is: For some reason anytime I make a change to my website I have to delete my cache. I believe for some reason everything is being cahched. I didn´t add cacheing to my code as I don´t know how to.

There´s not really much you can do. Other than change something and then refresh the page to see that nothing has changed. N/A

I’m using this software: Not using any software, just pure JS HTML and CSS

Additional information:

Your browser caches to speed up stuff. Do you use cloudflare?

Our servers enforce browser caching too. This normally helps to speed up websites, saves you in account resource usage and us in server load and bandwidth.

If you’re working on your website and would like to see changes immediately, you can use a private browsing tab while developing (which circumvents most caches) or open the developer console in your browser and disable cache there.


I do not use cloudflare.

Is there a way I can disable caching for everyone so that if I update my website everyone gets the changes immediately?

Maybe the caches can be disabled with .htaccess rules? I’m not sure if that works, but it’s worth a shot.

That said, I would highly urge you to keep the cache enabled though. Most websites are visited more frequently than they are updated, and disabling all cache will make your website appear slower and use more bandwidth (which is especially bad for mobile visitors). Any website performance optimization tool will tell you that you should enable cache as long as possible for as many files as possible.

In almost every case, a website not updating immediately for everyone is an acceptable trade-off for the performance benefits. And if that’s not acceptable, there are other methods to deal with cache than disabling it entirely.

For example, on the page your are looking at right now, all links to static files have a hash in the URL, which is based on the content of the file. If the content of the file changes, the URL changes, and this will cause browsers to fetch a new copy of the file. This way, most things on the page are cached aggressively, but we can still quickly push out new content by changing the URL.

1 Like

How could I go about doing this hash in the url thing?

The hash symbol ‘#’ is used to refer to an id. By itself, I think it refers to the body.
This question explains use of the hash symbol.

The “hash” in this context refers to the output produced by a cryptographic hashing algorithm. Not the pound symbol or it’s use as an anchor tag.

The hashes in this forum (and the InfinityFree front website) are produced by an automatic tool which generates combined and minified files when a new version is released. I think the tool used for both is called Sprockets, but that tool is written in Ruby and I don’t think that can be integrated in a PHP project.

The closest alternative I could find for PHP is Assetic, but I’m not sure whether it does URL hashing. In any case, that project hasn’t been updated for a few years already, so I’m not sure whether that’s a good decision.

Most projects these days use some sort of Javascript tool for asset management, like Gulp or Webpack. Although, integrating that with a PHP backend might not be super straight forward either.

Or you could just put a version number or date string in the file name and update those consistently when you make changes to the file.


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