Sail Knowledgebase

How to Change Your Primary Domain in WordPress with Sail CLI

In this article you will learn how to use the make-primary subcommand in Sail to change your primary domain name.

If you like Sail, consider sponsoring us via GitHub!

Make primary

After you've added and pointed your domain name to your Sail application, you can set your primary domain using the following command:

sail domain make-primary example.org

Depending on the size of your database, this make take a few minutes. It will:

  • Change your primary domain in your Sail config
  • Update the home and siteurl options in your WordPress database
  • Replace all occurrences of your previous domain with the new primary domain

If the primary domain in your database is already correct (typically after a backup import), you can skip the search and replace routine using the --skip-replace flag.

When adding an SSL certificate, it is also recommended to update your primary domain, to make sure it's the HTTPS version. You can use the --force flag for this.

If you're having trouble with updating your primary domain, feel free to get in touch.