Facebook, stop caching a page, how to?

34 views Asked by At

Lets say, I have an article which supposed to be shown next week, for an hour. When viewing this article, it defends itself:

if ($post->date < NEXT WEEK || $post->date > NEXT WEEK)
{
    header("HTTP/1.1 301 Moved Permanently");
    header('Location: http://example.com/404');
    exit();
}

this works very good but sadly a sitemap is working around here or whatever. Facebook still caches that 404 page. How to ask facebook not to cache that page?

1

There are 1 answers

2
Ivan On

Add follow strings:

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: " . date("r"));