WordPress is great as a content manager, but when you want to publish that content, the performance and other requirements can make it advisable to use another publishing environment. For example, you can use Django and the wordpress JSON API. In these cases you may be interested in redirecting calls to the public part of WordPress to another URL.
Here you have the code to redirect public calls to another url. Place it into functions.php.
add_action( 'template_redirect', 'my_template_redirect', 1 ); function my_template_redirect() { if ( !is_admin() && !wp_doing_ajax() && strpos($_SERVER['REQUEST_URI'], 'wp-admin')=== false && !is_user_logged_in()) { wp_redirect( "https://mynewsite.com", 301 ); exit(); } }