By default WordPress uses the "s" parameter as the query string to perform a site search. In some cases you may want to change this parameter to a different string. You can do this easily with the following function:
function change_search_url_rewrite() {
if ( is_search() && ! empty( $_GET['s'] ) ) {
wp_redirect( home_url( "/search/" ) . urlencode( get_query_var( 's' ) ) );
exit();
}
}
add_action( 'template_redirect', 'change_search_url_rewrite' );After adding this function, the search URL will be search/test instead of ?s=test