Forum Moderators: coopster
"To spare you ppl couple of hours of valuable time, you can only TOUCH a file that you own! Usually PHP is *nobody* "
So my question is, will an automated script using touch($file) effectively change the last modified, and if not, what is a better way to accomplish this.
(I have several frequently changing pages that just don't get crawled as frequently as I would like, and am thinking that the bots see them as static, unchanging pages as i am currently set up.)
WBF
If they are static html files, apache sends out the last-modified information. The commenter is correct, at the very least, the files have to be set so your webserver has write permissions for them. This would go, though, for any process you'd want to use PHP for. The file permissions are there to protect you.
On that page is a little script that loads frequently updated information.
Now of course, the displaying of new info generated by script does not change the http headers. That is where touch() would come in.
Currently the page shows a last modified date a couple of years old, though the content is freshly generated today.
My thought is to include touch() at the beginning of the content generation script. Something like
$file = $_SERVER['DOCUMENT_ROOT']."page.php";
touch($file);
$content = get_contents();
echo $content;
Now, I probably could have written and tested something in less time that it has taken me to write this, so I guess I will go try to do that :)
WBF