I can do it like this, but maybe you have a more beautiful solution?
function rudr_url_redirects() {
/* in this array: old URLs=>new URLs */
$redirect_rules = array(
array('old'=>'/shop/?filter_brand=rosenthal','new'=>'/rosenthal/'),
array('old'=>'/contacts/','new'=>'/Contacts/')
);
foreach( $redirect_rules as $rule ) :
// if URL of request matches with the one from the array, then redirect
if( urldecode($_SERVER['REQUEST_URI']) == $rule['old'] ) :
wp_redirect( site_url( $rule['new'] ), 301 );
exit();
endif;
endforeach;
}
add_action('template_redirect', 'rudr_url_redirects');