WordPress URL redirect and replace ? question mark

Into wordpress function file add following code and check it.

add_filter('query_vars', function( $vars ){
    $vars[] = 'parent'; 
    return $vars;
});

function archive_rewrite_rules() {
    add_rewrite_rule(
    '^(.*)/(.*)/?$',
    'index.php?post_type=client&name=$matches[1]&parent=$matches[2]',
    'top'
    );

    add_rewrite_rule(
    '^(.*)/?$',
    'index.php?post_type=client&name=$matches[1]',
    'top'
    );
    //flush_rewrite_rules(); // use only once
}

add_action( 'init', 'archive_rewrite_rules' );