Multiple domains showing same content

I have wordpress setup with the domain set as mydomain.com I have a secondary domain that is mydomain.com.au

Can I make wordpress use mydomain.com.au if someone comes to the site from a link that is mydomain.com.au. Any if they navigate through the site it stays as .com.au

But if they come from mydomain.com it stays on mydomain.com when navigating?

I've tried this but the url always shows as mydomain.com https://stackoverflow.com/questions/29915680/wordpress-2-domains-to-point-same-directory

Topic domain-mapping domain Wordpress

Category Web


There are several problems in your logic, as Wordpress won't know which domain is going to handle actions. Even if you use a symlink from the other domain to point to .com domain, or even if you use htaccess rules to redirect requests, when a user upload some image, will they be saved as .com.au images ? as .com images ? There are a lot of issues related with domains that you may properly think before to use two domains as a single one, but I think perhaps there's some solution using Wordpress MultiSite.

If you want this to work at any price, I think the best solution will be pointing the second domain folder as a symlink to the first one ( you will need ssh access to the server ) and use some rules on htaccess or within virtual host definition, to properly maintain .com.au urls as you want. Also, you should make the changes proposed on the solution you've mentioned ( so you will need to make this changes also: https://stackoverflow.com/questions/29915680/wordpress-2-domains-to-point-same-directory )

The htaccess trick could be as this:

RewriteCond %{HTTP_HOST} ^domain.com.au

RewriteRule ^(.*) http://domain.com/$1 [P]

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.