Simple WordPress/PHP/Javascript code snippet which redirects users, who are not logged into the website, to another designated URL.
Add this snippet to your theme’s functions.php file to use.
Be sure to change the value of $redirect_url from https://mjslawson.com to the URL users should be redirected to.
Create a directory: ‘maintenance’, and within place a simple HTML file: index.html. Landing pages should include a background image, logo and message maybe something like: “Scheduled Maintenance. Check back soon.” Throw in a couple social media links, a phone number if it’s appropriate and you’re good to go!
My maintenance page is available at: https://mjslawson.com/maintenance/
I’ve also used the code snippet on my old website to redirect to the new one, unless I’m logged in.