last modification date of web page unknown

I would like to check the age of the document in the webpage but it does not show! here is the result of a telnet to the server:

telnet av.hostoi.com 80
Connected to av.hostoi.com.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Tue, 23 Oct 2012 16:55:40 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Connection: close
Content-Type: text/html

Connection closed by foreign host. 

on another server the following 2 lines are also included which are not present above:

Last-Modified: Fri, 17 Jun 2011 11:17:45 GMT
ETag: "2ce392-b1-4a5e688eae840"

So I searched the internet and as far as I could figure out there should be a configuration in apache to set headers on and etag on in htaccess? but I couldn't find any place that shows that.

Here are the loaded modules in apache if it would help:

core mod_authn_file mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_default mod_auth_basic mod_include mod_filter mod_log_config mod_env mod_expires mod_headers mod_setenvif mod_version prefork http_core mod_mime mod_status mod_autoindex mod_asis mod_info mod_vhost_alias mod_negotiation mod_dir mod_actions mod_alias mod_rewrite mod_so mod_php5 mod_ruid2

As far as I read mod_header must be enabled which seems to be the case?

edit: tried the proposed solution: put a .htaccess file in / folder even though there is a file named do not upload here. contents of .htaccess:

#Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase / 
Options -Indexes 
SSILastModified on

<IfModule mod_expires.c>
FileETag MTime Size ExpiresActive on

ExpiresDefault "access plus 10 days"

ExpiresByType application/javascript "access plus 1 week" ExpiresByType application/x-javascript "access plus 1 week" ExpiresByType application/x-shockwave-flash "access plus 1 week"

ExpiresByType text/css "access plus 1 week"

ExpiresByType image/jpg "access plus 1 month" 
ExpiresByType image/jpeg "access plus 1 month" 
ExpiresByType image/gif "access plus 1 month" 
ExpiresByType image/png "access plus 1 month" 
ExpiresByType image/x-icon "access plus 6 month" 
ExpiresByType image/ico "access plus 6 month"
</IfModule>

i put this file in public_html folder and in the sub folder nod_update3 where the file update.ver exists. then i execute the script that checks the age of the document like so:

./check_http -H av.hostoi.com -u /nod_update3/update.ver -M 2d
HTTP CRITICAL: HTTP/1.1 200 OK - Document modification date unknown - 26316 bytes in 0,159 second response time |time=0,158965s;;;0,000000 size=26316B;;;0

as you can see no modification date is shown even though on the ftp client it shows it was last modified 25.10.2012

i tried the check on another file in the same folder like so:

./check_http -H av.hostoi.com -u /nod_update3/em000_32_l0.nup -M 2d
HTTP CRITICAL: HTTP/1.1 200 OK - Last modified 13,5 days ago - 56472 bytes in 1,059 second response time |time=1,059014s;;;0,000000 size=56472B;;;0
srvmon plugins #

as you can see the date modification is known. so why the problem with ver file? the file can be checked in this url: http://av.hostoi.com/nod_update3//update.ver


Solution 1:

X-Powered-By: PHP/5.2.17

It looks like that page is generated by PHP, in which case Apache doesn't know the Last Modified tamestamp. It is the PHP script's responsibility to set the Last-Modified header in this case, which it apparently doesn't do.

If these are simply static files then you probably want to configure Apache to serve them directly, instead of serving them via a PHP script. If they aren't static files then you need to fix the PHP script to set the Last-Modified header appropriately.

Solution 2:

By tracking back to the source code of Apache, we can see the root cause of this misconfiguration is that the semantics enabled by "Xbithack Full" implicitly overwrite the semantics enabled by "SSILastModified On".

if (conf->lastmodified > 0) {
  ... {
   ap_update_mtime(r, r->finfo.mtime);
   ap_set_last_modified(r);}}

else if (((conf->xbithack == XBITHACK_FULL ||
         (conf->xbithack == XBITHACK_UNSET &&
                DEFAULT_XBITHACK == XBITHACK_FULL))
        ...)) {
        ap_update_mtime(r, r->finfo.mtime);
        ap_set_last_modified(r);
}

So one possible solution would change the "SSILastModified on" to "XBitHack full".