Not by using the RedirectMatch
directive, if that is what you are using. But you can by using RewriteCond
and RewriteRule
. Then you can specify that the rewrite only occur for requests NOT from your IP. For example:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# !!! Enter Current IP address for admin access !!!
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteCond %{REQUEST_URI} ^wp-login.php [NC]
RewriteRule . https://new-domain.com/wp-login.php [R=301,L]
</IfModule>
Untested. Keep a backup ready at hand in case there’s a typo that crashes your site. Determine what your actual IP address is and use it in place of the one shown, but maintain the format shown with additional !^\
chars. This basically says “if the request is for wp-login.php AND the IP is NOT mine, redirect to the new domain.”
Assuming you have not redirected /wp-admin/ and /uploads/ requests and only redirected front end requests, this should be enough to get you into the back end. If you redirected /wp-admin/ and/or /uploads/ as well, you’ll need a similar rule set for those paths.