Facebook Twitter Instagram
    WiredRevolution.com
    • Home
    • About
    • Contact Us
    • Essential Linux Commands
    • Sitemap
    Facebook Twitter Instagram
    WiredRevolution.com
    web development

    Control search engine indexing with robots.txt

    RyanBy RyanSeptember 26, 2008Updated:October 1, 20081 Comment2 Mins Read
    Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Email

    If you wish to restrict all or part of your website from being indexed by various search engine robots you can use a robots.txt file.

    For it to work properly it should be a simple ASCII text file named exactly “robots.txt” and it should be placed in the domain root directory. The well behaved robot will look at this location for instructions before indexing anything on the website.

    You will need a separate robots.txt in the root directory for every sub domain you have as well. Apart from the root directory, a robots.txt file in any other location such as a subdirectory, will be ignored.

    The basic syntax involves two lines.

    • User-agent: the robot the following rule applies to
    • Disallow: the pages you want to block

    Here is a robots.txt that will block an entire site. An asterisk indicates all robots should be blocked.

    User-agent: *
    Disallow: /
    

    This will allow an entire domain. You can achieve the same thing by removing the robots.txt file as well.

    User-agent: *
    Disallow:
    

    You can block a specific robot.

    User-agent: googlebot
    Disallow: /
    

    Block a specific directory. Make sure you include the forward slash.

    User-agent: googlebot
    Disallow: /sample_directory/
    

    Block a specific file.

    User-agent: googlebot
    Disallow: /sample_file.htm
    

    Block a multiple directories and files.

    User-agent: *
    Disallow: /sample_directory1/
    Disallow: /sample_directory2/
    Disallow: /sample_file1.htm
    Disallow: /sample_file2.htm
    

    Block everything for every robot except for google which can index everything.

    User-agent: *
    Disallow: /
    
    User-agent: googlebot
    Disallow: 
    
    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Email
    Previous ArticleView real-time system statistics with top
    Next Article Securely copy remote files with scp
    Most Commented
    March 12, 2009

    Fix blue tinted video in Ubuntu

    September 10, 2010

    Setup SSH access between VirtualBox Host and Guest VMs

    March 8, 2011

    Install GNOME Shell in Ubuntu 10.10 Maverick

    April 4, 2009

    Setup the PS3 Bluetooth Controller on Ubuntu

    October 22, 2008

    How to correctly use LD_LIBRARY_PATH

    Recent Comments
    • Execute command on linux virtual machine (or server) from windows commandline on Setup SSH access between VirtualBox Host and Guest VMs
    • Solved: How to SSH to a VirtualBox guest externally through a host? - Daily Developer Blog on Setup SSH access between VirtualBox Host and Guest VMs
    • How to SSH to a VirtualBox guest externally through a host? [closed] – Code D3 on Setup SSH access between VirtualBox Host and Guest VMs
    • How to copy and paste from VirtualBox? [duplicate] on Setup SSH access between VirtualBox Host and Guest VMs
    • Jackie Laguna on Fix OpenGL: ChoosePixelFormat SketchUp error in WINE
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.