search ]

Prevent Search Engines from Indexing WordPress Search Result pages

It is possible and even advisable in most cases to prevent search engines from indexing the search results pages on WordPress sites.

You would want to do this in order not to waste crawl budget on pages that do not need to be indexed and also so that they do not appear in your Google Search Console Index Report.

Adding the following instructions to the robots.txt file will request Google and other search engines not to index the WordPress search results pages, assuming you have not made a special change to the functionality of the WordPress search mechanism.

Here is the code you need to add to the robots.txt file located in the root directory of the site:

User-agent: *
Disallow: /?s=
Disallow: /search/

Alternatively, if you are using the WordPress SEO by Yoast plugin, you can perform the same action through your site’s dashboard. Go to Yoast SEO in the admin interface and click on “Settings“.

Go to the “Advanced” tab and click on the “Crawl Optimization” option. Now under the section “Internal site search cleanup“, activate the option “Prevent crawling of internal site search URLs“.

How to block search engines and prevent them from indexing search result pages

So far, questions and comments are welcome…

Roee Yossef
Roee Yossef

I develop custom WordPress themes by design. I love typography, colors & everything between, and aim to provide high performance, seo optimized websites with a clean & semantic code.


Leave a Comment

Add code using the buttons below. For example, to add PHP click the PHP button & add the code inside the shortcode. Typo? Please let us know...