Need help with redirecting specific URL to a different URL on main domain

Hi there CyberPanel Community,
I’m new here and new to CyberPanel as well.
I’m in need of help.

I helped a client migrating his websites to CyberPanel and now he needs help with redirecting specific URLs to a different URL(s) on the main domain.

i.e.
child-domain.com/url1 to maindomain.com/url1
child-domain.com/url2 to maindomain.com/url2

There can be multiple redirects and I’m not sure how I should achieve this.

I’ve gone through these

Since I’m not into coding, I still can’t solve this.
Any help on this would be greatly appreciated.

Thank you and stay safe.

yes i can but you have write code in your function file

function redirect_page() {

 if (isset($_SERVER['HTTPS']) &&
    ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
    isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
    $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
    $protocol = 'https://';
    }
    else {
    $protocol = 'http://';
}

$currenturl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$currenturl_relative = wp_make_link_relative($currenturl);

switch ($currenturl_relative) {

    case '/oldslug':
        $urlto = home_url('newslug');
        break;
    
    default:
        return;

}

if ($currenturl != $urlto)
    exit( wp_redirect( $urlto ) );

}
add_action( ‘template_redirect’, ‘redirect_page’ );

dont change anything just paste in your function file make sure you are using child theme.

in the above code just change old slug and new slug