Defining www for new server and switching from non-www


I am currently developing a website not using www on .test and the staging server is just the ip address, but for the the production server I want to use www.
Another scenario is when I would like to change a live site from non-www to www.

I find the instructions a little lacking on the www aspect, and I see that some have issues with SSL when server is provisioned with incorrect www settings, so I just though i’d check to make sure I had it right.

Is this the settings below all that is required? And then when I migrate the DB from the staging site i just make sure to replace the ip address with the domain name (should it be the www or the non-www in the db replace?):

      - canonical:
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: # replace with your Git repo URL
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: master
      enabled: false
      enabled: true
      provider: letsencrypt
      enabled: true
      duration: 30s
      wp_env: production


If your canonical domain is without www, then I’d go without it for your wp_home and wp_siteurl as well.

The config you have there will redirect to

But yes in general that’s all the configuration you need (and all that’s available). If you ever have a WP database you’re copying to another environment, you’ll need to search/replace domain strings as you said.


For the search and replace, WP Migrate DB is the way to go

You can do find and replace as part of the export from local/staging to live,
eg //domain.test -> //