My blog, this site, actually has three URLs coming to it.
These are the three URLs that I choose to use in various places to link back here. Of course, it could be infinitely more. I could link Any-Sub-Domain-I-Want.marcovescio.com if I really needed to.
But back to my three URLs: I don’t want three different blogs. I want them all to come back to this one WordPress installation. At least for now…
Additionally, I’d like navigation to stay on the domain that each user entered the site on: Usually because I’ve pointed them to that particular link for a particular purpose. Or they followed it from my resume, business card, or other source.
The three URLs are actually only two domains: marcovescio.com and vesc.io
Each domain has a wildcard subdomain A record in their DNS (the subdomain is a *)
Configure Virtual Host
The server is listening for all subdomains of each domain
# NGINX Listen All Subdomains
At this point, you can enter my site from any subdomain and that page will initially display. But what happens when you click a link? Well, it uses the WordPress Address (URL) and Site Address (URL) options you’ve configured in Settings -> General.
We can get around this by blanking out both options — but this must be done from wp-config.php
Add the following lines to wp-config.php:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
Don’t forget to clear your cache.