I have a wordpress multisite with one site to domain.com and another to materials.domain.com
At the domain site I have a page domain.com/materials
I’d like to redirect the materials.domain.com homepage to the domain.com/materials
I’m using a child theme to my subdomain instalation and trying the following on functions.php
wp_redirect(home_url('https://domain.com/materials'),301);
exit;
Now when I access the materials.domain.com the showed url is https://materials.domain.com/https://domain.com/materials/
What i’m doing wrong? How can I achieve the correct redirection?
2 Answers
Have you tried creating the redirect within the CPanel of wherever your website is being hosted from? I manage all of my redirects there, rather than from within my functions.php. There’s a really simple guide on doing that here.
Or is there a specific reason that you would like the redirect to be within the functions.php?