How to redirect one domain to main domain but not its sub-domain?

I have .com .site and .org domain my main site lies in .org domain now i need to redirect my other domain to .org domain but one subdomain of .com is used for staging purpose. So, that How can i redirect my .com and .site domain to .org domain.

It would be helpful if you provide me a guideline.

Are you using trellis?
There are canonical and redirect domains:
https://roots.io/docs/trellis/master/wordpress-sites/#options

Yeah, I am using trellis. Should i have to put .org in redirects or what ?

I assume there is one primary/canonical domain? This is also good practice for SEO.
All other domains should redirect to that canonical domain.
If you got a WordPress site that shows different stuff for different domains, you can have multiple, different canonical domains.

In the simplest case you would simply add the canonical domain to the .org domain and add the other domains to the redirect for that canonical domain.

The staging subdomain would be added as canonical domain the other WordPress staging site.

I have set and provision my server but its not working. If we have any other method to redirect ?

What does mean that it isn’t working? DNS resolve error? Connection time out?
Have you configured the A and AAAA (if IPv6 is supported) DNS records for these domains?
Is HTTPS (Let’s Encrypt) enabled?

I have put my secondary domain in redirects and provision its done but redirects doesn’t work. Should I have to add IP address same as primary domain to secondary domains A record ?

Yes, of course, the A/AAAA (when IPv6 is also used) of all these domains must point to the Trelis web server. This redirection happens on HTTP level.

This topic was automatically closed after 42 days. New replies are no longer allowed.