Support Forums

Setting a Wordpress Site Redirect leads to Netlify deploys failing

I have built a headless site with Next.js and it has the default domain name of https://rcefcenglishministry.netlify.app/. Although I have setup englishministry.rcefc.org as the primary domain by changing the CNAME record on the hosting site.

The CMS is Wordpress which is hosted at english.rcefc.org.

What I want to do is redirect all english.rcefc.org to englishministry.rcefc.org which points to the netlify app. However the moment I change the redirect site through the Wordpress Redirection plugin then build fails.

I assume what is happening is that the build fails as it can’t get the necessary data through graphql at wordpress host since it redirects to netlify?

The error has show above can’t get any of the paths leading to the undefined error. Even after catching the undefines, it just results in a site that has no pages outside of the home page.

Any suggestions would be much appreciated.

Hi @lambert-chan

Welcome to the Netlify community

Is this Redirection – WordPress plugin | WordPress.org plugin you are using?

In any event, you will likely need to set up some regular expressions to match all URLs except those required when building and content publishing. I managed to find Headless Mode – WordPress plugin | WordPress.org which apparently sets everything up for you and this do-it-yourself method Redirect Headless WordPress | Blog

Another option you have is to redirect all traffic to the site except for specified IP addresses (including those which you need to access it from.) Whitelisting access to headless wordpress during builds via nginx covers this topic.

Hope this provides some useful information for you.

Thank you for the warm welcome.

I checked all the Netlify plugins to see if one could help the redirect better and didn’t think of checking for alternative Wordpress plugins…

The Headless Mode - WordPress plugin worked like a charm.

Thanks for the prompt assistance!

1 Like