InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

robots.txt

  • Online robots.txt check
  • wildcard
  • disallow all
  • resubmit robots.txt to Google
  • Googlebot and js, css crawl
  • robot noindex, follow for wordpress
  • Allow Google adsense bot
  • parse robots.txt using python
 
  • Home
  • > Tutorials
  • > Web Development
  • > SEO
  • > robots.txt

How to prevent your test blog from google crawling but show adsense ads

By admin | Last updated on Mar 15, 2016

I guess most of us maintain a test or sandbox blog to try out new plugins and do experiments which we can’t afford on main production blog. To ensure Google and other crawlers/bots don’t crawl your test/sandbox blog, this robots.txt file can be used:

User-agent: *
Disallow: /

This would work fine from web search crawler perspective. But in case you display adsense ads on your blog, those would also be blocked. Google crawls each web page as “Mediapartners-Google” bot to decide what type of ads to serve on the page. If test site is blocked for all crawlers, then it would not serve ads on the test blog site. One option is to use this robots.txt to allow it for just Mediapartners-Google.

User-agent: *
Disallow: /

User-agent: Mediapartners-Google
Disallow:

Now why would someone want to serve Google ads on a test site? It is to see how the whole site looks to user before you propagate a change to your production server.

Also note that the order of entries does not matter in robots.txt. Most specific entry takes precedence over generic one.

Suggested posts:

  1. WordPress mysql query to get all posts with a missing custom field
  2. Screenflow 4 export options
  3. Css :last-of-type selector – last child element of type
  4. SVG – beginner tutorial
  5. Ssh automation on Amazon EC2 Ubuntu Linux
  6. Chrome extension tutorial – hello world
  7. How to view flash debug log using Firefox on Mac
  8. Github tutorial for beginners
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged robots.txt, SEO, Tutorials, Web Development, Wordpress
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress