treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Prevent Search Bots from Indexing Search Results

Last updated on:

In the <head> section of your header.php file:

<?php if(is_search()) { ?>
   <meta name="robots" content="noindex, nofollow" /> 
<?php }?>
View Comments

Comments

  1. This piece of code seems to be very useful. I never thought about this before, but yes, I definitely don’t want my search results page to be followed by robots.

Leave a Comment

Use markdown or basic HTML and be nice.