Files not updating in CPanel

Status
Not open for further replies.

optiqwor

New Member
Messages
13
Reaction score
0
Points
1
I've noticed a few times that when I update a CSS or HTML file it for some reason won't update for a loooooong time. It's been over an hour and when I refresh the page it still doesn't show the updated files. Is there some type of limit or block that activates after so long? Why is this happening?
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
Why is this happening?
x10hosting recently implemented a different web-server-software setup on their free-hosting servers - which is a combination of the Apache web server and the Varnish cache server
the cache server maybe why there is a delay before you 'see' the file - after you upload it

staff has said - to override [ Varnish cache ] try adding the following line to your [ .htaccess ] file in folder [ public_html ]
Code:
Header set Cache-Control "max-age=0, private, no-cache, no-store, must-revalidate"
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
It's just a text file named .htaccess. That's right, just a dot and an extension with nothing before the dot; that's how hidden files are named in Unix-type systems. An .htaccess file is primarily meant to control file access in a folder (permissions and so on), but (especially on a web server) it performs a number of other functions as well, in this case giving instructions to the web server as to how to handle file headers (telling caches not to cache the files). All you need to do is create the file if it's not there already.
 

optiqwor

New Member
Messages
13
Reaction score
0
Points
1
ok I'll have to read more into that. But I just updated a css file and went to my directory in another browser window and pulled it up, and I could see all the new updates I made, but when I open the page it's connected to the page still opens up with the settings of the older one still shows up, so the files are indeed updating, it's as if the page is still reading the old ones somehow. Does that sound like something the server setup could be causing?
 

chatngox

Member
Messages
122
Reaction score
3
Points
18
You will need to clear cached files in order to see changes. Meantime for testing purposes to avoid your local DNS cache you can try this site.
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
That's what the cache is intended to do. It stores versions of pages that aren't going to change (or parts of pages - that part's kind of complicated to go into, and it means using edge-side includes on your pages). That means the Apache server and PHP don't have to figure it out from scratch every time a visitor hits the page, and it can often serve the page from memory rather than from disk, which is a lot faster. It also tells the user's browser (and other servers along the path) to keep a copy of everything that is unlikely to change for a long time (like CSS and JS files, images and so forth) so they don't have to request them again at all for a long time.

It an be a genuine pain in the sitting-down parts when you're trying to develop a site, but it lets you do an awful lot more an awful lot faster with "less server" in production. It's sort of expected that you'd do your development somewhere other than on your production server, and that a few minutes' delay deploying updates isn't quite as important as making sure your users don't have to wait forever for your pages to load. The .htaccess file command will let you do immediate updates (although you might need to clear your browser's local cache by removing your site from your browser's history). Once things are the way you want them, you'll probably find that your site performs better with the cache enabled.
 
Status
Not open for further replies.
Top