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;
}
?>
Related Posts:
- “Too many redirects” ONLY when trying to access wp-admin page
- Wrong canonical link on wp-admin pages
- Can’t access admin dashboard with wp-admin without /index.php after it
- WordPress /wp-admin redirect to wrong port in docker
- Admin Page Redirect
- Unable to login and wp-login.php redirects to wp-admin%2F&reauth=1?
- Use a different domain for SSL
- .htaccess in wp-admin produces a redirect loop
- Change Login URL Without Plugin
- Securing wp-admin folder – Purpose? Importance?
- stop redirection on /wp-admin call to /wp-login
- wp-admin produces a 302 redirect to itself
- Users are redirected to homepage instead of wp-admin
- WordPress in sub directory wp-admin problem
- Options for restricting access to wp-admin
- Unwanted redirect in admin area
- .htaccess rewrite rule for removing .php extension with exception of wp login and wp-admin
- Login to wp-admin “redirect_to” points to wrong URL after migration
- wp-login.php — redirect logged in users to custom URL
- Can’t access wp-admin Internal Server Error 500
- How to change “wp-admin” to something else without search-replacing the core?
- Why should I password protect WP-Admin?
- Change Dashboard url
- WordPress subdomain wp-admin redirects to main domain
- Call to undefined function insert_with_markers
- Block access to wp-admin
- Cannot log into WordPress Dashboard after removing/adding .htaccess
- Should I add the IP of the server that hosts my sites to the list of authorized IPs in the wp-admin/.htaccess?
- Which HTTP headers to use for subdomain embedding?
- CDN + WP Admin Query – .htaccess redirection
- From 403 error to 500 internal server error
- Why is there an intermediate redirect to https://public-url.org/wp-admin?
- Prevent /wp-admin/ from redirecting to homepage?
- https://mydomain/wp-admin redirects to wp-login.php?redirect_to=https%3A%2F%2Fmydomain%2Fwp-admin%2F&reauth=1
- Cannot Access Admin Area After Migration
- Wrong wp-admin URL
- Redirect non-admin users away from wp-admin/index.php (main dashboard page) to wp-admin/profile.php
- How do I host WordPress on a hidden domain through a reverse proxy?
- How to Change The WordPress Login URL Without Plugin
- WordPress (behind HAProxy and Jetty), not multisite, in sub folder – and /en/wp-admin/ keeps redirecting to /wp-admin/
- Created a new subdomain with same content. Should I add a redirect in my old subdomain?
- wp-admin – 404 after custom login form
- How to fix ‘WordPress redirection loop problem in wp-login.php page’?
- 404 redirect wp-login and wp-admin after changing login url [closed]
- wp-admin 302 redirects
- Too many redirects after added SSL redirect on port 80 virtual host
- Can’t access wp-admin, redirects to http://%24domain/wp-admin/
- How login is possible, if I deny login page via .htaccess with allow ip
- Unable to properly login
- Restrict access to admin-post.php
- Admin sometimes redirects to HTTPS
- Blank page when viewing wp-admin
- Too Many Redirects – WP-Admin Only
- WP Admin Login keeps redirecting to login
- CPU overload spam – redirect link to wp-admin and new post
- How to access wp-admin from original website after setting the domain redirect/forwarding
- wp-admin going directly to 404
- Login redirect_to url is pointing to a url with the port
- Redirect from wp-admin back to page
- Can’t access WP-Admin via HTTPS
- wp-admin and wp-login.php not Accessible after Cloudflare
- Wp-admin Redirection loop after moving to subdirectory
- Trying to login to my site redirects me to the first page
- Avoid executing a function (redirect) if I’m in the admin area
- stop customize.php redirect to login page if admin is not logged in
- wp-admin redirects to standard wordpress page
- I cannot go to http://novathon.cloud.reply.eu/wp-admin – always redirected to /wp-login
- Disabling WP-Admin Caching in htaccess
- Unable to log in as admin
- Random HTTPs redirections at admin area in shared hosting
- Limit access to wp-admin but still be able to log in from different locations?
- SSL doesn’t deliver parts of WordPress Administration Module
- Making WP Admin Folder accessable JUST under a different link
- How can visitors redirect wp-admin to the homepage?
- Couple questions about .htaccess, login page, updates
- Why when I click on a link into the WP admin panel I am redirected to a link that doesn’t contains wp-admin prefix, so I obtain 404 error
- Remove “Time to upgrade” message from dashboard
- Looking for a hook to add attachment information to the media library tab
- Get Stylesheet To Showup in WP Admin Panel Editor
- Just how ‘expensive’ is this function?
- Why can’t I access files / directories outside of wordpress
- How do I change the upload file size limit in single-site wordpress install?
- Can’t call external stylesheet for WordPress admin (using wp_admin_css)?
- Restore a layout [closed]
- 301-redirect directives for blogger to wordpress migration
- White screen of death on admin and other dashboard pages
- WordPress Side Menu Admin Panel Default Order numbers List?
- Why can I log into wp-login.php and not wp-admin.php?
- Redirect specific URL before other redirects take place in .htaccess?
- Is there a simple way to set wordpress site files back to out of the box?
- CSS of the admin panel
- wp-admin blocking causing http error on uploads
- DISALLOW_FILE_EDIT is false but I still am not able to edit files from the admin interface and the menus do not show up
- Cant access wp-admin
- How can I trigger a javascript function after a post update on edit post screen in wordpress admin panel?
- restrict admin panel sections to users
- WordPress Login for multiple sites
- Need rewrite for URL with specific string
- Action for opening edit page in admin?
- My website does not load since two days!