I'm trying to write a redirect so that anyone who tries visiting "www.example.au" is directed to "www.example.com", but I'm not sure how to do that in my .htaccess file.

So far, I've tried:

RedirectMatch 301 ^.au /
RedirectMatch 301 https://www.example.au /
RedirectMatch 301 ^.au /

But I'm not seeing any results. What's the proper way to setup this redirect?

  • Added an answer, and for reference note this isn't specifically a Wordpress question, even though it may be to do with a Wordpress site for you. You may find this quesiton gets closed or you get better results for non Wordpress questions on stack overflow or server fault
    – mozboz
    Jul 6 '20 at 14:09
  • What you describe is not a "subdomain" redirect; it's an entirely different domain.
    – MrWhite
    Jul 6 '20 at 15:07

Found answer here, first result by searching redirect to different domain apache htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^example.au$ [OR]
  RewriteCond %{HTTP_HOST} ^www.example.au$
  RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]

It doesn't matter if just your TLD is different the same format will work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.