WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to stop search engine indexing of search results pages (3 posts)

  1. cofour
    Member
    Posted 6 years ago #

    Hi there,

    I have version 2.5.1. wordpress installed at "my domain".com. I have noticed a problem that I do not know how to fix. When I do a google search, I get a lot of results for search entries. For example, one of my posts is titled "Boxes" and I notice that on my google search of "my domain".com I will get hits for the search box page on my website looking for "Boxes."

    Is there some way to disable search entries on "my domain".com from being indexed on google, etc.?

    Any help gratefully appreciated. Thanks.

    Cofour

  2. iridiax
    Member
    Posted 6 years ago #

    Put the following in your header.php before the closing </head> and only the first page of your blog, blog posts, and blog pages will be indexed:

    <?php if (((is_home()) && ($paged <= "1")) or (is_single()) or (is_page())) { ?>
    <meta name="robots" content="index, follow"/>
    <?php } else { ?>
    <meta name="robots" content="noindex,follow"/>
    <?php } ?>

    This is a good way to prevent duplicate content issues with Google. You can add or remove conditions to this based on conditional tags:

    http://codex.wordpress.org/Conditional_Tags

    Here's a method to just stop indexing of search results:

    <?php if (is_search()) { ?>
    <meta name="robots" content="noindex,follow"/>
    <?php } else { ?>
    <meta name="robots" content="index, follow"/>
    <?php } ?>
  3. cofour
    Member
    Posted 6 years ago #

    Great - will give the second method a try. Thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic