Is is appropriate to 301-redirect users after a search with only one result?

78 views Asked by At

I have a website that is a large database containing pages on people, theaters, and plays, with a search engine. When the user performs a search, they are presented with a search results page (/index.php?parameter=some+name). From there they can click a link like /index.php?idP=42 and get the page about person #42.

However if there is only one result, to save the user some time, we don't display the search results, instead we directly show the only page corresponding to the search. The problem is that what looks like the real page about person #42 has the URL /index.php?parameter=some+name. If someone puts it into their favorites, in the future it might turn into a link to a search results page, if we create another person containing “some name.”

Should I use a 301 redirect when there is only one result, taking the user to /index.php?idP=42? Would a 302 redirect, or something entirely different, be more appropriate?

EDIT: I'm now aware of the possible issues with this behaviour on the user experience side, but I'd like to keep this question on the technical side: how should I redirect the user? 301 or 302 redirect, or something else?

1

There are 1 answers

1
sylbru On BEST ANSWER

In case someone is interested, I'm considering using a 303 or 307 response code.

301 Moved Permanently seems clearly incorrect in this situation, as the same search might not redirect at all the user in the future.

303 See Other or 307 Temporary Redirect seem to be much more appropriate.

More on Wikipedia: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection