Mobile app version of vmapp.org
Login or Join
Gonzalez347

: What is the correct way to write my "robots.txt" file? I have written the following code inside my robots.txt file: User-Agent: Googlebot Disallow: User-agent: Mediapartners-Google

@Gonzalez347

Posted in: #RobotsTxt

I have written the following code inside my robots.txt file:

User-Agent: Googlebot
Disallow:

User-agent: Mediapartners-Google
Disallow:

Sitemap: example.com/sitemap.xml

Is my robots.txt is correct? I only want two user agent to follow my site (i.e., Googlebot & Mediapartners-Google).

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Gonzalez347

2 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

Almost, see the bottom of the section named, "Blocking user-agents" in the following: Google Webmaster Tools: Block or remove pages using a robots.txt file

According that, you should have:

User-agent: *
Disallow: /

User-agent: Googlebot
Allow: /

User-agent: Mediapartners-Google
Allow: /

sitemap: example.com/sitemap.xml

See the bottom of the page in the above link for how to test your robots.txt file.

10% popularity Vote Up Vote Down


 

@Tiffany637

Nearly, you need to Disallow all the other bots first though.

The wild card (*) below means all bots.

User-agent: *
Disallow: /

User-Agent: Googlebot
Disallow:

User-agent: Mediapartners-Google
Disallow:

Sitemap: example.com/sitemap.xml

Although please note, not all web crawlers will obey robots.txt.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme