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

2 comments

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

{ 2 comments… read them below or add one }

Roezer March 31, 2012 at 3:41 pm

With ht.access is it possible also

Reply

John Methew April 29, 2012 at 2:48 pm

thnx man… i really need this script.

Reply

Leave a Comment

What is 10 + 5 ?
Please leave these two fields as-is:
Solve the simple math (so we know that you are a human)

Previous post:

Next post: