• Resolved Gary Gordon

    (@garymgordon)


    Redirect an entire site but still allow users to log into the site.

    For example, if I want to redirect a site (and all subfolders and pages) to another URL (domain), but still have access to logging into either https://sitename.com/wp-login.php or https://sitename.com/wp-admin/, and to view the site (after logging in) so I can see the site (as if it wasn’t being redirected), how can I set this up in the Redirection plugin? With or without Regex? What exactly would the settings be for each part? Is this possible to help with? I just seem to be having a problem with this.

    Thanks,
    Gary

Viewing 1 replies (of 1 total)
  • Hi Gary,

    I believe you could try using the Position to make sure /wp-login.php and /wp-admin/ URLs are not redirected. Be careful to check your .htaccess (or equivalent config file) for redirects that may affect this operation:

    Regex [x]
    Source URL: /wp-login.php(.*)
    When matched: Do nothing (ignore)
    Position: 1

    Regex [x]
    Source URL: /wp-admin/(.*)
    When matched: Do nothing (ignore)
    Position: 2

    Regex [x]
    Source URL: /(.*)
    Target URL: https://www.newdomain.com/$1
    When matched: Redirect to URL // With HTTP code: 301 – Permanent redirect
    Position: 3

    Also, you may have to create other redirects before the “redirect eveything” rule on position 3, if you have services that count on accessing your website externally, such as a cronjob or xmlrpc. You’d have to test whether or not services such as these would still work. And if they don’t, create other redirects, keeping of course the “redirect everything” rule at the last position.

    • This reply was modified 6 years, 1 month ago by CB.
    • This reply was modified 6 years, 1 month ago by CB.
Viewing 1 replies (of 1 total)
  • The topic ‘Redirect an entire site but still allow users to log into the site.’ is closed to new replies.