Changing a Website’s Primary Domain: Switch with an Alias

3 min read

IMPORTANT: Multisite Notice

Please note that domain swap functionality (as well as cloning and staging functionality) does not work with WordPress multisite. It is only available for regular WordPress installations.

GridPane includes functionality in the Control Panel to manage and configure the domains for your WordPress sites. 

The primary domain of the GridPane site is what we think of when we think of the site URL. In this article we’ll cover how to switch the primary domain using an Alias.

Before we can change the primary domain, we first have to create the new domain as an Alias. To do this, we have a thorough walk through that you can view here: –

Adding an Alias Domain to a GridPane Site

Once you have an Alias set up, below are the steps to change your websites primary domain. 

Cloning vs Domain Swapping

GridPane offers the ability to swap your website’s domain or clone from one domain to another. In most cases, cloning instead of swapping domains may be the better option.

The domain swap process is more resource intensive and also means that any previous backups of the website will no longer be accessible, as backups are attached to a specific domain name.

With cloning, your backups remain available on the original domain, and should any issues occur during a clone, the original site will be unaffected. With a domain swap, should anything go wrong, both the new and old sites can be affected.

These articles detail how to clone your website to a new domain on a new server, or a new domain on the same server:

Cloning a site to a new URL on a different server

Cloning a site to a new URL on the same server

Step 1: Prepare

There are some steps that may be necessary and speed up the time it takes to run the swap.

Step 1.1: Disable the Staging and Update sites (if they exist)

To make the domain change, you’ll first have to disable the staging and update websites for this domain if they exist. Inside the configuration modal > Domains tab, you’ll see this notification if these exist.

Turning these off is quick and easy. Simply navigate to the Staging and Update pages inside your dashboard and toggle them off for the website on which you’re switching the domain. The image below demonstrates disabling the Staging website. The process is the same for an Update website if you also have this enabled.

Step 1.2: Deactivate any 301 Redirect SSL’s

Next, if you have any 301 redirects attached to this website and the redirect has an SSL certificate, you will need to deactivate the SSL before proceeding. If there are any 301 redirects that have an active SSL, the domain change will fail. You can easily deactivate any redirect SSLs by toggling them off as shown below.

Step 1.3: Speed up database rewrites

The domain swap will initiate a search and replace in your database to swap your URLs over. 

You can reduce the time this takes by ensuring both the live and alias domain have an SSL certificate before the swap begins.

If both domains have an SSL certificate before the swap/push, the system doesn’t need to check for HTTP/HTTPS URLs and can use a simpler compound regex.

If neither the primary nor alias domain have an SSL, and it will run efficiently as is.

You can learn more about GridPane search and replace functions in this article:

GridPane Database Rewrites and Workflow

Step 2: Switching the domain

We’re now ready to make the primary domain change. Navigate to the website and open the configuration modal, then click on the domains tab. Click on the Alias that you wish to become the primary domain and you’ll see this notice:

Confirm you’ve selected the correct Alias and click Save.

You’ve now changed the primary domain for your website.