I’m running a website and for a couple months I’ll have to disable my primary domain. Right now I’m running this website in CentOS 7.3 Webmin 1.840 and with Let’s Encrypt Certificate.

I need to make this website available to other domain in real-time, and at the same time, disable my primary one. Something like this:

primarydomain.com (disabled for a while, but providing real-time data to secondary domain)
secondarydomain.tk (all data from primarydomain.com being shown here, just like proxy/domain alias, with all redirects, links, images… set to secondarydomain.tk).

I’ve already setup Cloudflare for the secondarydomain.tk only with A type (IP) and as soon as I type secondarydomain.tk in the web browser, it get’s redirected to primarydomain.com.

I’ve tried to create virtual server in all modes in Virtualmin: Top-level server, Sub-server and Alias of primarydomain.com (with/without own email), but the maximum I could achieve was when I browse secondarydomain.tk, it shows primarydomain.com homepage, but ALL LINKS it’s still linked to primarydomain.com. So I can’t click anywhere.

Besides that, all traffic should be in SSL (https), so my htaccess of primary domain is set to:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.primarydomain.com/$1 [R,L]

By the way, the secondarydomain CAN (and probably SHOULD) share the same vhost folder, so:

/home/primarydomain

Should be equal for both.

Could someone help me achieve this?
Btw, my english is rusty and probably I’ve made lots of english mistakes above :P.

Read more here: VirtualMin + WordPress Multiple Domain, same site, same ip


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: