Hello,
Thank you for your patience.
We’ve checked the site, and the internal search URL is already set to nofollow
and index
Could you please confirm if you have already resolved this issue?
Looking forward to helping you.
Hi Reinelle,
I think you might use the wrong search URLs.
https://example.com/search/keyword
https://example.com/?s=keyword
By the way, could you help me delete the URL of my site and your screenshot?
I thought I could edit it or remove it, this info is private.
Thanks,
Chris
Hello,
We have separated your concern into a new ticket so we can assist you accordingly. Also, your website URL has been moved to the sensitive data section and the screenshot is removed as well.
In this case, please replace the previous filter and apply this one instead:
add_filter('rank_math/frontend/robots', function ($robots) {
$url = home_url($_SERVER['REQUEST_URI']);
if (strpos($url, '/?s=') !== false || strpos($url,'/search/')) {
$robots['follow'] = 'nofollow';
}
return $robots;
});
Let us know how this goes.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.