To make changes to the generated content, you will need to enable the mod_substitute extension. According to the documentation, change directives can be made both at the Directory level and in .htaccess .
If it is necessary to change the generation of only href links, then the directive should look something like this:
AddOutputFilterByType SUBSTITUTE text/html Substitute "s|http://site.ru/search/|http://site.ru/|ni"
in this case, a case-independent replacement of the substring without the use of regular expressions should be performed, which should replace all links beginning with http://site.ru/search/ to http://site.ru/ (more precisely, the beginning of links).
But it should be understood that in addition to the links in the html-content there may be other places of use of addresses, including java-scripts, various attributes, etc.
mod_substituteis used - teranmod_substitution- teran