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
- Wildcard multisite wp-admin url wrongfully redirected
- 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
- Word press wp-admin redirecting to reauth=1
- Sort admin menu items
- Force HTTPS using .htaccess – stuck in redirect loop
- How to add notification bubble for my custom admin menu page
- Can I rename the wp-admin folder?
- What’s the purpose of admin canonical tag?
- How to display multiple custom columns in the wp-admin users.php?
- Redirect from https to http or from http to https? [closed]
- How to Remove Checkbox for Excerpt Under Screen Options
- Remove order field from Page Attributes box
- how to redirect to url.com/wp-admin if url.com/admin is typed in?
- How to set up htaccess to redirect a particular post type or subdirectory to HTTPS?
- WordPress category page redirects in .htaccess not working
- Is it possible to create two different wp-admins for a wp website
- Cannot change Connection Information in admin interface
- WordPress blog clone.. wp-admin issue
- How do I fix wp-admin error when exporting reusable blocks?
- wp-config.php not affecting my site
- How to prevent spams from admin-ajax.php file?
- Checkbox not showing as checked on UserProfile (even with checked=”checked”)
- Admin user getting redirected to /wp-admin/user
- Removing Author name
- Https Website: CSS and JS files load in http and admin page does not load too