Redirect an entire WordPress site on a subdomain, except wp-admin

Answering my own question for future reference. I couldn’t get a redirect to work with .htaccess, but found some helpful troubleshooting suggestions, mainly this one: https://stackoverflow.com/a/14116956/3218102.

I ended up doing this with a modification to header.php and the functions wp_redirect and is_admin.

This is the code I added to the top of header.php:

<?php 
// Redirect everyone to new URL, except admin
if ( ! is_admin() ) {
     wp_redirect( 'http://www.newsite.co.uk/', 301 ); 
     exit;
}
?>