I have two domains for a website (we're using Apache), example.com
and example.org
. The website responds to a wildcard subdomain for both of these. I want, however, to have the .com as the canonical domain. By that, I mean, I want to redirect (301) everything to the .com, but maintain the subdomain. For example.
example.org => example.com
sub.example.org => sub.example.com
I don't know enough about regular expressions to work out how to set this up. Can anyone point me in the right direction?