im trying to redirect all users who click on the register

HI,

im trying to redirect all users who click on the register link from the default wordpress login to be redirected to the main site and also i want to check if current page is wp-login.php and then redirect user to the login page url.

Here's what i have so far.

this function is working fine, because it redirect users to the signup page from the main site.

add_action('init','user_redirect_login_registration');

function user_redirect_login_registration(){
    //global variables
    global $pagenow;
    if($pagenow == 'wp-signup.php') {
          wp_redirect(network_site_url('signup'));
         // exit();
        }
}

but this one, even when user to on site1.mainsite.com/wp-login.php it just gives a 404 error instead of redirecting the user to a login page

add_action('init','user_redirect_registration',99);

function user_redirect_registration(){
    //global variables
    global $pagenow;
    if($pagenow == 'wp-login.php') {
          wp_redirect(home_url('login'));
         // exit();
        }
}

NB. i've tried with/without the 99

Thanks for the help.