Block All Bots But Only Allow Mediapartners-Google (Adsense Bot)

I recently wanted to block all bots visiting http://example.com/view/1.php, http://example.com/view/2.php but only allow Google Adsense bot.

I recently wanted to block all bots visiting http://example.com/view/1.php, http://example.com/view/2.php but only allow Google Adsense bot. You need to edit robots.txt (a text file prevent cooperating web spiders and other web robots from accessing all or part of a website) as follows

User-agent: Mediapartners-Google
Allow: /

User-agent: *
Disallow: /view/*.php

Author: admin

I like chocolate, gadgets, open source software, photography, traveling and all shades of green colors. I love spending time with fun loving friends and family members. This is my own online journal.

2 thoughts on “Block All Bots But Only Allow Mediapartners-Google (Adsense Bot)”

Leave a Reply

Your email address will not be published. Required fields are marked *