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 pixel-perfect custom WordPress themes, delivering high-performance, SEO-optimized websites. Have a project in mind? need assistance? Feel free to contact me!

0 Comments...

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!