Last Updated on September 21, 2023 EDT by Jordan
Content Error or Suggest an Edit
Notice a grammatical error or technical inaccuracy? Let us know; we will give you credit!
At the current moment, you can’t change the primary domain name for a GridPane site, you’re stuck with the original domain. This causes problems even when you add an additional temporary domain.
As an example, let’s say you have a server named srv01.managingwp.io pointed to 192.168.0.1 and you set up a wildcard record in DNS for *.srv01.managingwp.io also pointed to the same IP Address.
You set up a new site called newsite.com and add a temporary domain of newsite.srv01.managingwp.io to the site in GridPane. This temporary domain will resolve automatically due to the wildcard record.
You can visit the temporary domain newsite.srv01.managingwp.io and see a default WordPress site as we’ve just created the site in GridPane. However, you’re unable to access /wp-admin as it redirects to the primary domain newsite.com which is pointed to another server that you’re trying to migrate away from.
You have two options to get around this issue.
DISCLAIMER
The following commands change how your GridPane server functions. This may void any support provide by GridPane, use at your own discretion. If you contact GridPane support, inform them that you made these changes.
Advice/Tip
If you want to know how to enable SSH for GridPane system users and su from root, see this article. Enabling SSH for GridPane System Users (Including su from root)
Option 1 – Change WordPress Domain using wp-config.php and wp-cli search-replace
You can update the wp-config.php and change the domain name.
/* GridPane site routing */ define('WP_HOME', 'newsite.srv01.managingwp.io'); define('WP_SITEURL', newsite.srv01.managingwp.io');
And then run wp-cli search-replace to find and replace the primary domain with the new temporary domain.
wp-cli search-replace http://newsite.com http://newsite.srv01.managingwp.io
Option 2 – Using the Multiple Domain plugin.
You can use a plugin called Multiple Domain, which does exactly what it’s named. It will allow you to use two or more domains on your WordPress install.
Unfortunately, you can’t log in to the sites WordPress admin to install and configure the plugin. This is where wp-cli comes in.
wp plugin install multiple-domain --activate wp --format=json option set multiple-domain-domains '{"newsite.com":{"base":null,"lang":null,"protocol":"auto"},"newsite.srv01.managingwp.io":{"base":null,"lang":null,"protocol":"auto"}}'
Last Updated on September 21, 2023 EDT by Jordan