we had our Wordpress page running on example.com.

But now, we're developing new React website, which already has some of the webpages ready. We use Vercel to host that React website.

We want React/Vercel to host specific pages (which are already developed) and serve the wordpress page as a fallback.


React already has page example.com/pageA ready, so we want that URL to be served directly by Vercel/React.

On the other hand, React doesn't has page example.com/pageB ready, so we want to use Wordpress's page as a fallback. We've set routing in our React app and it just asks the fallback domain for the address it missess.

For that reason we've created subdomain legacy.example.com which points to old Wordpress webpage and redirected our main example.com domain to Vercel. In the case, when user tries to hit example.com/pageB, the Vercel asks Wordpress under legacy.example.com/pageB address and response with that page at example.com/pageB.

We've had some problems with Wordpress as it tried to redirect pages to the same adress (creating redirect loop) but we manage it by adding remove_filter('template_redirect','redirect_canonical');.

But, we still have problem when trying to log in into admin panel. After accesing example.com/wp-admin we're getting redirected to https://example.com/wp-login.php?redirect_to=https%3A%2F%2Flegacy.example.coml%2Fwp-admin%2F&reauth=1. Trying to log on that page doesn't work - we're being redirected to the same page and nothing happens.

How can I solve that issue when loging?

Also - is there a better option than turning off canonical redirects? I'm afraid of some side effects of that. The siteurl and home properties are still set to https://example.com.

  • "the Vercel asks Wordpress" - it sounds like there's some specific DNS configuration we should be aware of here... Also, how is WordPress responding to requests for legacy.example.com when it's site and home URLs are configured to serve content on example.com?
    – bosco
    May 17 at 22:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.