Redirection confusion

Mike Dewhirst <[email protected]> Sat, 8 Feb 2025 21:31:44 +1100
Newsgroups gmane.comp.apache.user
Message-ID <[email protected]>
I have a number of domain names which I want to redirect in order to 
have a single search engine site.

mysite.com
mysite.com.au
mysite.au
www.mysite.com
www.mysite.com.au
www.mysite.au

I want mysite.com to be the single site for seo purposes. I want any of 
the above to force redirection to mysite.com and not display the 
user-entered domain.

Not only have I researched this via the docs I have asked three 
different AIs and none of their solutions work as desired despite 
seemingly complying with the docs. I have to accept the blame for the 
prompts.

Here is my best guess at a proper redirection for all domain names ...

files: mysite.com.conf, www.mysite.com.conf, mysite.com.au.conf, 
www.mysite.com.au.conf, mysite.au.conf, www.mysite.au.conf
<VirtualHost *:80>
     ServerName mysite.com
     ServerAlias www.mysite.com mysite.com.au www.mysite.com.au 
mysite.au www.mysite.au
     RewriteEngine On
     RewriteRule ^(.*)$ https://mysite.com/$1 [R=301,L]
     Redirect permanent / https://mysite.com/
</VirtualHost>
end file mysite.com.au

All have been enabled (a2ensite ...) on Ubuntu 2024.04 LTS server

The main conf file for mysite.com is mysite.com-le-ssl.conf and it has 
the *:443 configuration.

Many thanks for any education/clarification in layman terms.

Cheers

Mike
OpenPGP_signature.asc (application/pgp-signature, 495 B)
-----BEGIN PGP SIGNATURE-----

wsB5BAABCAAjFiEE/NCg7Xf1UydoVFgpGvW31BqCOLMFAmenMpAFAwAAAAAACgkQGvW31BqCOLMI
MAf+Jb9hCHhXRgTXcmgyKm35ZkPRJwweSMXVaebRGq9raozioiHfFXneCmNksUSHUbghRzQmLwcx
vlR8eZ7/vFH1gvCmZ0XSWZP7gz+lvTL/lHQacK/zO/YcVSkwPi6ZhJolhI3M0UYXWiJIPMYqyfou
p8FjpNkSvpaw4/+CEUuE3M+zjDgS+WwNtm06k15GkpYdQpG2UMyP+GvvLJCc9nkiyZiF22G4Zf8O
BQiSscuC97rfjbteHDIjwy4kMWespRrYhRqM7f89sjxh/V3puROEb/dzkxWGC6HGewdHyh8lwxxh
ixVaghUaR2fi2SDizflyZzFQqDecmL9l2I/2q1g7gQ==
=ZTqi
-----END PGP SIGNATURE-----