admin管理员组文章数量:1122832
I have wordpress setup with the domain set as mydomain I have a secondary domain that is mydomain.au
Can I make wordpress use mydomain.au if someone comes to the site from a link that is mydomain.au. Any if they navigate through the site it stays as .au
But if they come from mydomain it stays on mydomain when navigating?
I've tried this but the url always shows as mydomain
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
Share Improve this question asked Jun 6, 2017 at 6:08 user1681447user1681447 411 silver badge3 bronze badges 3- can you please add your code? – inarilo Commented Jun 6, 2017 at 7:23
- if your theme does not use those variables it may not work, another option is using htaccess redirects – inarilo Commented Jun 6, 2017 at 7:25
- It might be tough because the site URL is recorded in the database. If you don't have to have both domains you could use a 301 redirect from one to the other. If what you are trying to achieve is sending us aussies to .com.au and others to dot com you might consider geo locating? Maxmind can check if ip is within australia. But it's not 100% accurtate. – Admiral Noisy Bottom Commented Jun 15, 2020 at 8:55
1 Answer
Reset to default 1There 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]
本文标签: Multiple domains showing same content
版权声明:本文标题:Multiple domains showing same content 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736311867a1934894.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论