Yes, it is possible by checking the referer on your target page before rendering the page. There may be a better way to solve your task, however, if you want to share more details. Setting a cookie, passing a parameter with the URL – there is usually more than one way to address a problem.
In answer to your question, wp_get_referer()
will return the URL for the page the user arrived from or false if from the same page. https://developer.wordpress.org/reference/functions/wp_get_referer/
If your home page URL is ‘http://mypage.local’, this would work. Again, this is probably not the best approach for your project:
$referer = wp_get_referer();
if ( 'http://mypage.local' !== $referer ) {
// User arrived from another source so send them away!
wp_redirect( 'http://mypage.local/otherpage' );
exit;
}