简体   繁体   中英

Facebook, stop caching a page, how to?

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?

Add follow strings:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM