Step 1:
Open your favorite text editor and create a file called
robots.txt.
Step 2:
Place the following code in this file.
Code:
# Deny all robots that we do not specifically want to allow
User-agent: *
Disallow: /
# Allow these robots only
User-agent: googlebot
Allow: /
The code above will block all bots from accessing your website, with the exception of Google (googlebot).
**See the end of this post for more search engines / robots that are safe to add to your robots.txt file.
Step 3:
Save the file and upload it to your
public_html directory. You can upload it via FTP or through the cPanel file manager.
More Good Bots to allow
The example above only uses Googlebot. There are others that you may want to add to your robots.txt file. Here are a few.
- Googlebot-News - Google News
- Googlebot-Image - Google Images
- Googlebot-Mobile - Google Mobile
- MSNBot - Microsoft MSN
- Teoma - Teoma Search
- bingbot - Bing Search
- Slurp - yahoo! Search
- Scooter - AltaVista Search
- Scrubby - Scrub the Web
You can add them into the robots.txt file in the following format:
Code:
User-agent: BOTNAME
Allow: /
Where
BOTNAME is the name of the bot listed above.
So one example of a robots.txt file which bans all robots except yahoo, bing, and google might look like this:
Code:
# Deny all robots that we do not specifically want to allow
User-agent: *
Disallow: /
# Allow these robots only
User-agent: slurp
Allow: /
User-agent: bingbot
Allow: /
User-agent: googlebot
Allow: /
.