Suppose you want your visitor not to see any specific pages and want them to redirect to login or register page, then you can do this using this following code. Here i used the body class of wordpress page. Using the Body class and using php and jquery you can redirect it .
<?php
$classes = get_body_class();
if (in_array('my-profile',$classes) || in_array('page-id-2324',$classes) ) {
if( ! is_user_logged_in() ) {
?>
<script>
window.location.href = "https://yoursiteurl.com/register/";
</script>
<?php
}}
?>