WAMP server not updating files if there is an index.html
Posted by: a_das (223.191.16.---)
Date: September 15, 2019 04:46PM

I have WAMP 3.1.9, with the following components (updated):
∙ Apache 2.4.41
∙ PHP 7.3.9
on Windows 7, 64-bit. I am testing out some stuff and I am not very proficient with the intricacies of web servers.

-------------------------------------------------------------------------------------------------------------

The problem is like this:-

Scenario 1:

I create a virtual host, named testsite1 and put two HTML files in its directory, named page1.html and page2.html. page1.html has a link in it to page2.html and the latter has some text. That's it.

I visit [testsite1], it opens an Apache directory listing (naturally, because there is no index file); I click on page1.html, it opens; I click on the link and page2.html opens.

Now, if I delete the page2.html file from the directory (from my computer) and repeat the above, when I click on the link (to go to page2.html), I get a 404 error, "page not found". (Of course, because I deleted it!)


Scenario 2:

I create a virtual host, named testsite2 and put two HTML files in its directory, named index.html and page2.html. index.html has a link in it to page2.html and the latter has some text.

I visit [testsite2], it opens to index.html; I click on the link and page2.html opens.

Now, if I delete the page2.html file from the directory (from my computer) and repeat the above, when I click on the link (to go to page2.html), it still opens! Apparently, something is not "updating". Also, if I change some page title, change some JavaScript, etc., they would get reflected at some random point, not immediately like in scenario 1.

(It is the same in Internet Explorer as well as in Mozilla Firefox.)

Now, of course it is a caching issue: the "non-existent" stuff don't fall out of the sky, right?! And it can be resolved with a browser history clearing or with a cache refresh (CTRL+F5) while at the problematic page.

Apparently, the presence of index.html is the issue here.

-------------------------------------------------------------------------------------------------------------

My questions are:
∙ Why pages/contents/files DO NOT get updated immediately in scenario 2?
∙ Then, why pages/contents/files DO get updated immediately in scenario 1?

Wouldn't this be a problem if it was a website on an online server?

N.B.: If I put a .htaccess file at the root of testsite1 (scenario 1), with the line DirectoryIndex page1.html, visiting [testsite1] directly opens up page1.html, but there is no such issue as in scenario 2.

Options: ReplyQuote
Re: WAMP server not updating files if there is an index.html
Posted by: Otomatic (Moderator)
Date: September 15, 2019 06:11PM

Hi,

The management of caches, both browsers and html/php pages, is your responsibility, not that of the server.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: WAMP server not updating files if there is an index.html
Posted by: a_das (223.176.109.---)
Date: September 15, 2019 07:48PM

Thank you for your response. It's hard to get responses in many public forums. :-)

Yes, I agree. But, can you please tell me WHY this happens (not how to prevent it), so that I could fix it.

Like I said in my post:
∙ Why pages/contents/files DO NOT get updated immediately in scenario 2?
∙ Then, why pages/contents/files DO get updated immediately in scenario 1?

Options: ReplyQuote
Re: WAMP server not updating files if there is an index.html
Posted by: Otomatic (Moderator)
Date: September 15, 2019 09:00PM

Hi,

I don't have an answer to your questions and I'm afraid there will be no stereotypical answers.

The cache or rather should I say caches depend on many factors of which the two main types are the server, so Apache which can have its own cache, PHP which can also have several types of cache like opcache, header cache-control headers, expires, session_cache_limiter, varnish cache, etc. All these caches are "managed" by the server, so the cache files are at the host, the second main type being the caches of the browser used for which the cache files are at the client.
And to all this, it is necessary to add the caches specific to CMS and WEB applications.

Now you understand why it is absolutely impossible to say why it works in one case and not in the other.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.