You can prevent search engines from indexing your search result pages by making sure they can’t access them.
By including the following directives in your robots.txt file, you prevent all search engines from indexing search result pages on your WordPress website, assuming:
- no changes were made to search result pages’ way of functioning and
- that no search result pages are already indexed.
Here’s the code to do this:
If for whatever reason your robots.txt is changed, and the search result pages become accessible for search engines it’s great if you have a second line of defense.
Make sure that you implement the <meta name=”robots” content=”noindex”> attribute on all of your search result pages.