In short
Every search run in your site’s internal search engine produces a URL (/?s=chaussures, /search?q=robe+rouge). These pages almost never have any value in Google or Bing results: they duplicate your categories, are often empty and form an endless URL space. The check consists of getting them out of the index, then keeping them out of crawling, while using their data to create real pages where demand exists. Once it is done, no results page is indexed and frequent searches each have a stable landing page.
Why it matters
A results page is generated on the fly for any query. For a search engine, it raises three problems:
- Infinite space: every word, typo or combination with sorting and pagination creates a new URL. Google lists these URLs among those best blocked to focus crawling on unique pages; see avoid infinite URL spaces (opens in a new tab).
- Thin or empty content: the page repeats excerpts from other pages or shows “No results”. These are duplicates and soft 404s in the making.
- Abuse: anyone can create a link to
https://example.com/?s=un+terme+indésirable. If the page is indexable, it displays that term under your domain name, in the title and the content.
The fix comes in two stages, because the two tools do not combine on the same URL. noindex removes pages that are already indexed, provided the bot can crawl them to read the directive. A Disallow in robots.txt then keeps bots from spending time on them, but a blocked URL stays in the index if it was already there and receives links.
For generative engines, these pages add nothing: a list of links generated for a query is not a source an assistant can usefully cite. The real answers to these searches should live in content or category pages.
What it improves
- Crawling Bots stop crawling endless variants. A clear effect on sites with many links to their search or a large catalog; minor on a small site.
- Index quality Fewer duplicates, empty pages and soft 404s in Search Console.
- Brand protection No more indexed pages displaying terms injected by third parties.
- Traffic Indirect and positive when frequent searches become real category or content pages, better designed to rank.
- Rankings No direct effect on other pages.
How to check
1. Find the URL of your results. Run a search on your site and note the URL: /?s=, /search?q=, /recherche?, /catalogsearch/result/?q=, /search/node?keys=.
2. What is indexed.
site:example.com inurl:s=
site:example.com inurl:search
site:example.com inurl:recherche
In Search Console, the Performance report filtered on pages containing ?s= or /search shows whether these URLs get impressions. The Page indexing report often lists them among soft 404s and pages crawled but not indexed.
3. The directive on a results page.
curl -sI "https://example.com/?s=test" | grep -i "x-robots-tag"
curl -s "https://example.com/?s=test" | grep -i -o -E '<meta[^>]+name="robots"[^>]*>'
Expected result: noindex in the header or the tag.
4. robots.txt. curl -s https://example.com/robots.txt | grep -i -E "search|\?s=|recherche". Note whether a rule already blocks these URLs: if pages are still indexed, that block prevents the noindex from being read.
5. Internal links. With Screaming Frog, check that no page exposes a link to a search URL: keyword clouds, “popular searches” in the footer, tag links pointing to the search.
How to implement
Before you start
Choose the sequence according to the situation:
| Situation | Step 1 | Step 2 |
|---|---|---|
| Results pages are indexed | noindex on every results page, with no robots.txt block |
once the report no longer shows any, add Disallow if crawling of these URLs is significant in your logs |
| No page is indexed, new or recently cleaned-up site | Disallow search URLs |
noindex as a safety net |
| The platform already blocks them in robots.txt and pages remain indexed | temporarily remove the block, set noindex |
restore the block once the pages are gone |
Then use the data instead of throwing it away. Export the most frequent searches from your analytics tool (in Google Analytics, the site search parameter is configured in the data stream’s enhanced measurement; Matomo has an internal search report). For each frequent query without a dedicated page, create a category, a collection or a piece of content with a stable, indexable URL linked from the navigation. The method is detailed in analyze internal search (opens in a new tab).
| Internal query | Searches per month | Existing page | Decision |
|---|---|---|---|
| women’s trail shoes | 420 | no | create the /chaussures-trail-femme category |
| parcel return | 310 | /aide/retours, poorly linked |
link it from the footer and the order page |
| size 39 | 180 | category filter | nothing: the filter is enough |
Apache
Versions Apache 2.4.
Set the header on every results page, in the virtual host or the .htaccess (mod_headers enabled):
<If "%{QUERY_STRING} =~ /(^|&)(s|q|search)=/ || %{REQUEST_URI} =~ m#^/(search|recherche)(/|$)#">
Header set X-Robots-Tag "noindex, follow"
</If>
Adapt the parameter names so as not to target other pages that might use q. Reload with sudo apachectl configtest && sudo systemctl reload apache2.
Nginx
Versions Nginx 1.18 and later.
In the http context (for example /etc/nginx/conf.d/recherche.conf):
map $arg_s$arg_q $is_search {
"" "";
default "noindex, follow";
}
Then in the site’s server block:
add_header X-Robots-Tag $is_search always;
location ^~ /recherche {
add_header X-Robots-Tag "noindex, follow" always;
try_files $uri $uri/ /index.php?$query_string;
}
An add_header with an empty value sends nothing: other pages are not affected. A location block that contains its own add_header directives (the PHP one, for example) does not inherit those of the server block: add the line add_header X-Robots-Tag $is_search always; and your security headers there. Reload with sudo nginx -t && sudo systemctl reload nginx.
Cloudflare
Versions Cloudflare dashboard, all plans, November 2026.
In the Rules Overview, create a response header transform rule:
any(http.request.uri.args.names[*] == "s") or any(http.request.uri.args.names[*] == "q") or starts_with(http.request.uri.path, "/recherche")
Action: set X-Robots-Tag to noindex, follow. To limit abuse, a rate limiting rule on the search path also protects the server from bots that query it in a loop.
WordPress
Versions WordPress 6.4 and later (native noindex since 5.7), Yoast SEO 20 and later, Rank Math 1.0.
WordPress itself adds noindex to results pages (?s=) since version 5.7, through the wp_robots_noindex_search function. Check it with curl: a plugin or theme may have removed this filter. Yoast SEO and Rank Math also keep these pages noindex.
Complete it in robots.txt once the pages have left the index, through your SEO plugin’s robots.txt editor or the physical file:
User-agent: *
Disallow: /?s=
Disallow: /search/
/search/ covers rewritten URLs of the /search/term/ kind that WordPress also accepts. WooCommerce product search (?s=…&post_type=product) is covered by the same rule.
Shopify
Versions Online Store 2.0 themes, Liquid, all Shopify plans, November 2026.
Add the tag to the search template, in Online Store > Themes > Edit code, file layout/theme.liquid, inside <head>:
{% if template contains 'search' %}
<meta name="robots" content="noindex">
{% endif %}
Then open /robots.txt: if /search is not blocked there and your results pages have left the index, add the rule through a robots.txt.liquid template (Edit code > Add a new template > robots):
{% for group in robots.default_groups %}
{{- group.user_agent }}
{%- for rule in group.rules -%}
{{ rule }}
{%- endfor -%}
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /search' }}
{%- endif -%}
{%- if group.sitemap != blank -%}
{{ group.sitemap }}
{%- endif -%}
{% endfor %}
Keep the default rules in the loop: Shopify updates them.
PrestaShop
Versions PrestaShop 8 and 9.
PrestaShop already handles both sides: the search controller sends noindex on results pages (page.meta.robots variable, output by the theme), and the robots.txt generated in Shop Parameters > Traffic & SEO blocks search (the rewritten URL of the search page in each language, controller=search, ?search_query=). Check with curl that your theme does output the tag. If results pages remain indexed, temporarily remove these lines from robots.txt, then regenerate the file once they have disappeared.
Magento
Versions Magento Open Source and Adobe Commerce 2.4.
Results are served under /catalogsearch/result/. In Content > Design > Configuration, “Search Engine Robots” section, add to the custom instructions:
User-agent: *
Disallow: /catalogsearch/
If these pages are already indexed, start by setting noindex on this path at server level (Apache or Nginx sections), then add the robots.txt rule.
Drupal
Versions Drupal 10 and 11, core Search module or Search API.
Search module results are served under /search/node?keys=. The robots.txt shipped with Drupal already blocks /search/ and /search?. If pages remain indexed, temporarily remove these lines, set the noindex header on /search at server level (Apache or Nginx sections), then restore the block once they have disappeared. A search built with Views and Search API is handled the same way on its own path.
Laravel
Versions Laravel 10 to 13.
Set the header on the search route with the middleware described in check meta robots and X-Robots-Tag (opens in a new tab):
Route::get('/recherche', [SearchController::class, 'index'])
->middleware(SetRobotsHeader::class.':noindex,follow')
->name('search');
Also return a 200 status with a clear message when there are no results, and do not generate internal links to search URLs.
Next.js
Versions Next.js 15 and 16 (App Router).
// app/recherche/page.js
export const metadata = {
robots: { index: false, follow: true },
};
With client-side search (Algolia InstantSearch, Meilisearch, in-house search), the results URL is often synchronized with the state (?query=). Set the directive on that route and add disallow: ['/recherche'] in app/robots.js once the pages have left the index.
Common mistakes
- Blocking already indexed pages in robots.txt: they stay in the index, and the
noindexis never read. - Linking to search from the site: a “popular searches” cloud or tags pointing to
?s=invite bots into the infinite space. - Indexing search as a substitute for categories: a page generated per query does not replace a properly built category, with a title, text and internal links.
- Targeting too broad a parameter: blocking
qorseverywhere can affect another feature of the site. - Deleting search logs: they are your best data on real demand.
- Returning a 404 when there are no results: the visitor thinks the page is broken. A 200 with
noindexand suggestions is better. - Forgetting other languages:
/en/search,/de/sucheneed the same rules.
Frequently asked questions
Should internal search results pages be indexed?
Almost never. These pages are generated on the fly for any query, duplicate your categories, are often empty and form an unlimited URL space. Google recommends blocking this type of URL to focus crawling on unique pages. When a search comes up often, create a real category or dedicated content instead, with a stable and indexable URL.
Noindex or robots.txt for internal search pages?
Both, but one after the other. If results pages are already indexed, set noindex first and leave them crawlable: the bot must read the directive to remove them. Once they have disappeared from the indexing report, add the Disallow rule in robots.txt so that bots stop crawling them. On a new site with no indexed pages, the block can come straight away.
Does WordPress set search results to noindex by default?
Yes. Since version 5.7, WordPress adds noindex to its internal search results pages through the wp_robots_noindex_search function, and Yoast SEO or Rank Math keep this behavior. Check it on your site with curl, because a theme or plugin can remove this filter. The robots.txt block, however, is not added automatically: add it once the pages have left the index.
What should I do with the most frequent internal searches?
Use them as a demand study. Export the queries from Google Analytics, Matomo or your internal search engine’s logs, then check for each one whether a page already answers it. If not, create a category, a collection or dedicated content, link it from the navigation and leave the results pages themselves set to noindex.
Resources
- Google: Large site owner’s guide to managing your crawl budgetdevelopers.google.com
- Google: Block indexing with noindexdevelopers.google.com
- Google: Introduction to robots.txtdevelopers.google.com
- WordPress: wp_robots_noindex_search functiondeveloper.wordpress.org
- Shopify: Hide a page from search engines and Customize robots.txt.liquidhelp.shopify.com
- Adobe Commerce: SEO overview and robotsexperienceleague.adobe.com
- Cloudflare: Response Header Transform Rulesdevelopers.cloudflare.com
Updated on
Topic checklist (PDF)