On Sat, Feb 8, 2025 at 5:32 AM Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> 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 > You don't need to use mod_rewrite for this, just use "Redirect permanent / https://mysite.com/". That being said, those are not your domain name, and it's rude to use someone else's domain names. Use example.tld if you must. If you need help, you need to show apachectl -S, the URL you requested, and what happened, exactly. Also, test with curl.