How to change the canonical link from a category or taxonomy archive?

I found the solution by myself:

function yoast_seo_canonical_change_archives( $canonical ) {
    if ( is_tax( 'tourist-spots' ) ) {
    $path = parse_url( $canonical, PHP_URL_PATH );
    return 'https://www.luxuryvillasphuketthailand.com' . $path;
    }
    return $canonical;
}
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_archives', 10, 1 );