0

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 http://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 http://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 http://testsite1/ directly opens up page1.html, but there is no such issue as in scenario 2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.