Redirect your site with the custom domain name

Daniel Chiu
WEB learning notes — Project based
2 min readDec 10, 2017

WordPress on GCP tutorial series

When purchasing the SSL certificates for your site (own domain name), you can find out there are many choices, like single standard domain, multi-domain, wildcard… etc.

But one thing you may not know is that yourdomain.com and www.yourdomain.com are two different domains under single standard product. In this case, you can buy a premium product, and make sure both of those two sites urls can have a green safety tag. Or you can redirect all the visitors from one site to another, and only buy SSL for that one.

In other cases, although you have bought a SSL for your site, people who use http traffic link still can’t get the green safety tag. And you will want those visitors to be redirected to use https traffic.

Access the SSH

GCP provides a quick link to access SSL. Go to your Deployment Manager, choose the deployment, click SSH button.

Access the SSL

Redirect the url

  1. Access the SSH.
  2. Enter the following code. (Which means using nano editor to modify wp-config file)

3. Find the following two rows:

and replace it with:

if you want a www. in front of the domain name, just add it

4. Press Ctrl + X exit the window.

5. Press Y for yes.

6. Press Enter to ensure the file path.

7. Now enter the following code to restart the server.

8. Wait for it, till you receive the following message.

9. Refresh and access your site, now you find it works.

--

--

Daniel Chiu
WEB learning notes — Project based

| Market strategic analyst / Demand planner | Graduate from NTU MBA/ME