Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

If you want google's cache of your site to remain unchanged is it a good idea to add noarchive to robots.txt? Or will this wipe out your caches?

share|improve this question

migrated from serverfault.com Dec 18 '11 at 19:27

This question came from our site for system and network administrators.

    
As a note if you're interested, Cloudflare free plan includes a more "on demand" sorta cached site. Only comes online if your server is down, whereas G always makes cached available. I'm not affiliated with CF just figured I'd let ya know. –  dhaupin Feb 25 at 0:33

2 Answers 2

up vote 4 down vote accepted

Firstly, there is no such thing as noarchive in robots.txt. You need to add a meta tag to all pages on which you wish to prevent caching:

<meta name="Googlebot" content="noarchive">

When you have done that, then Google will stop caching the page entirely and won't show a cache link at all. There is no way to keep showing the old cache while preventing new caches.

share|improve this answer

The only problem is, it could take a month before Google re-crawls your entire site.

add_action( 'wp_head', 'add_meta_tag' );
function add_meta_tag() {
echo '<META NAME="GOOGLEBOT" CONTENT="NOARCHIVE">';
}
  1. Add this PHP to your child themes functions file
  2. Then re-build your site map
  3. And submit the sitemap URL to Webmaster Tools > Crawl > Fetch as Google
share|improve this answer
1  
Whoe man, please note that the above script is for WordPress. We don't need folks dropping in undefined functions to their non-wp platforms. Also you are better off doing that in htaccess using X_ROBOTS header for a fully encompassed flag. Think media files and stuff. –  dhaupin Feb 25 at 0:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.