Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Code Newbie > Submit Tutorials > HTML / CSS

Reply
 
LinkBack Thread Tools Display Modes
Old 08-26-2004, 05:13 PM   #1 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 170
DavH27 is on a distinguished road
ROBOTS.txt -- Hiding files and dirs from search bot spiders

Do you ever wonder why Google sometimes returns some obscure pages such as custom error pages? Well it is because the web author has not uploaded a ROBOTS.txt file to their root directory!

Input the following relevant lines into a plain text editor such as notepad and be sure to save it as ROBOTS.txt .

You can stop all spiders from indexing the entire site (not recommended if you wish to be listed at all)
Code:
User-agent: *     #This means all spiders
Disallow: /      # This means the entire site.
Code:
User-agent: Googlebot       #Only Googlebot is specified to be disallowed
Disallow: /secret       #This stops the Googlebot from indexing any pages in the www.homepage.com/secret directory
Code:
User-agent: Googlebot
User-agent: Roverdog
Disallow: SecretAgents.html
Disallow: /Porn/RudeStuff.php       
# This one shows that more then one spider can be specified. It also shows that individual files can be disallowed from indexing as well as whole directories. The file paths havwe to be relative, though.
You can find user agent names in your own logs by checking for requests to robots.txt. Most major search engines have short names for their spiders. Or, you can just find a list of bots.

Now save your file as ROBOTS.txt for the final time and uplaod it to your site's root directory. Unlike .htaccess files, you only need one of these files and it should be in the root directory.

I hope you have found this short tutorial easy to follow, useful and informative!

Please contact me in the forums if you have any problems with the above lines of code or have any suggestions or related feedback.
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 12:50 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting