WordPress.org

Ready to get started?Download WordPress

Forums

Disallowing Archive Folders which method is best? (1 post)

  1. drumat5280
    Member
    Posted 6 years ago #

    I want to disallow the robots to my archive folders (/2007/) but not my category folders.

    I tried to do this with my robots.txt file but it doesn't work when I checked it on Webmaster Central:
    # WordPress
    User-agent: Googlebot
    Disallow: /2006/
    Disallow: /2007/

    So then I placed this code in my header.php file but it not only disallows the bots from the archive but the categories as well.

    <?php if (is_archive()){
    echo "<meta name=\"robots\" content=\"noindex,follow\">\n";}

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic