We can redirect subdomains by changing the Nginx configuration files. We can:
The easiest way to do this is with Cloudflare's Page Rules, but we have a limited number of free page rules, so we can save them by doing these subdomain redirects on the server.
Set up SSL
We need to the domains have SSL certificates set up. First, configure the URL in the Ghost installation directory,
Then, set up the SSL Certificates.
If you started your droplet with
https://domain.tld, then the SSL for
domain.tld was arleady installed as part of the 1-Click installation process. If you are moving from
domain.tld, then you'll need to redo the above steps for
If the server says you already have the SSL certificates set up, but they don't work, you can locate the SSL configuration files, delete them, and start over.
Locate the files
We'll need to change two of the four files in
You can update these files by the command line using either the nano or vim editors, but you can also use FileZilla.
Redirect www.domain.tld to domain.tld
www.domain.tld-ssl.conf so it looks like this, changing
domain.tld to what yours is:
We need to keep the stuff about the ssl certificate in order for the certificates to renew.
Then update your
www.domain.tld.conf so it looks like this, changing
www.domain.tld. to what yours is:
Redirect domain.tld to www.domain.tld
Do the same thing as above, just switch the
www.domain.tld and vice versa.
Reconfigure the domain to the one you want:
Check the configuration:
Restart ghost to make the changes take into effect: