Some people, may want to point multiple domains to a single WordPress installation, and have it so that the navigation stays on the Domain that each visitor originally enters the site on. These instructions show you how using domain aliases and a quick edit to your wp-config.php file.
Create a Domain Alias
Note: Adding a domain alias varies from host to host. Check with them for exact instructions on how to create an alias.
- Register the domain(s) you want as the alias.
- On your domain registrar or hosting account (wherever you manage your DNS settings), select a domain from the domain list. Choose the domain you will want to use to access your WordPress dashboard and create/edit posts.
- In the Domain Aliases section of that domain, create an alias.
- Enter the domain alias. This must be a fully qualified domain name, e.g. example.com.
- If the domain alias is registered on a different DNS server, leave the create DNS zone box unchecked if you are asked. The domain alias will not be maintained and mail service will be inaccessible for this domain alias.
- Some domain registrars allow you to create a DNS zone if you want a DNS record for this domain alias to be created on this hosting server. This allows you to create and edit custom DNS records for the domain alias and mail service. You can then set the alias domain up with its own mail service if desired.
At this point, you can use any of the alias URLs, however once you click a link, it will send you to the main domain. To get around this, add the following lines to wp-config.php so that the domain that each visitor originally enters the site on will stay on that domain.
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']); define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
Reconfigure Pages and Posts if Necessary
Now your domains will all use one WordPress installation. Keep in mind, you will also need remove the domain URL on posts on any link or image for your site so they will always use the correct domain URL.
Change domainurl/the-name-of-my-post to /the-name-of-my-post/
Change domainurl/wp-content/uploads/2018/06/image.jpg to /wp-content/uploads/2018/06/image.jpg
With this technique, you can add as many aliases as your like, although you might want to check into SEO best practices to make sure that pointing multiple domains to a single WordPress installation is the best choice for you.
The post Point Multiple Domains to a Single WordPress Installation appeared first on MHM Podcast Network.