I wanna write a search plugin for a CMS. my search url is something like this: domain.com/serach.php?q=blah. now I wanna send 404 status on search queries that don't have any results. is it ok for search engines? I don't want that search engines send users too my search script that don't have any results. for example if "something" search query don't have any results in my website, search engines get that and don't show domain.com/search.php?q=something in its result. how can I do that?
I agree with Juhana, how would robots land on a page that shows no result in the first place?
Besides, be aware that all query parameters are not always taken into account or considered leading to different pages = they might be considered as the same canonical page.
For example, especially if you have more than one ("q
") parameter(s) in reality, the fact that you reply with 404 for a given query might lead to other queries on your script search.php
be considered as 404.
Thus i would not recommend what you're suggesting. Use maybe the <meta name="robots" content="noindex">
tag instead.