Skip to content

Instantly share code, notes, and snippets.

@facelordgists
Last active July 20, 2017 18:50
Show Gist options
  • Save facelordgists/27923b1b699036bd5b01348b939187ff to your computer and use it in GitHub Desktop.
Save facelordgists/27923b1b699036bd5b01348b939187ff to your computer and use it in GitHub Desktop.
Redirect WordPress admin to temp page. Useful for migrating /migrate / migrations of WP installs
# Add these lines to your .htaccess file and upload migrating.html alongside it
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin/(.*)$
#RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$ #Add your IP address here if you want to whitelist it
RewriteRule ^(.*)$ /migrating.html [R=301,L]
</IfModule>
<!DOCTYPE html>
<html>
<head>
<title>Migration in progress</title>
</head>
<body>
<h1> Migration in progress</h1>
<p>This site is currently undergoing migration to another server, and cannot be edited until migration is complete.</p>
<p>Sorry for the inconvenience and thank you for you cooperation. </p>
<p>See Roadside Dental Marketing support team for more info.</p>
</body>
</html>
@facelordgists
Copy link
Author

When migrating a site, and there's a delay between cloning it to a new server, and updating the DNS to point to it, it's a good idea to lock down the admin dashboard to prevent edits. This will keep the two installs from getting out of sync, and avoid having to remigrate the site a second time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment