After you’ve installed WordPress and pointed your domain name to Google Cloud, there are additional steps required to configure your domain name so that it works properly with your WordPress website.


In this two-part tutorial, I will show you step-by-step how to change your WordPress settings to point to your new domain name.


It is also recommended that you reserve a static IP address for your WordPress website on Google Cloud before starting this tutorial.

There are 2 options in this tutorial:

  • 1. WordPress Bitnami instructions
  • 2. WordPress Click-to-deploy instructions
  • 1. WordPress Bitnami instructions

    If you’re using the Bitnami version of WordPress on Google Cloud, changing your website URLs via Settings > General is disabled. Instead, you should change your URLs by editing your wp-config.php file.

compute engine

From your Google Cloud Platform dashboard navigate to Compute Engine > VM Instances.

ssh google cloud platform

Once inside of your Compute Engine, click on the SSH button to connect to your WordPress installation.

domain configuration wordpress on google cloud

Once connected via SSH, connect as a root user and open your wp-config.php file in the nano editor.

sudo -i
nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

domain configuration wordpress on google cloud

Inside of your wp-config.php file, you will need to replace your SiteURL and HomeURL definitions as shown below.

REPLACE THIS: 

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');


WITH THIS: 

define('WP_HOME','http://example.com'); 
define('WP_SITEURL','http://example.com');

Remember to replace example.com with either the www. or non-www. version of your domain name – whichever your prefer. For example:

define('WP_SITEURL', 'http://www.yourdomain.com/');
define('WP_HOME', 'http://www.yourdomain.com/');

If you’ve already configured SSL for your domain, you should substitute the http://in the code above for https:// instead. For example:

define('WP_SITEURL', 'https://www.yourdomain.com/');
define('WP_HOME', 'https://www.yourdomain.com/');

Next, make sure to verify your website’s permalink structure. This setting often gets corrupted after changing your domain name settings. You can access your permalink settings by going to Settings > Permalinks.

change permalink structure

Make sure to verify your permalink structure after changing your domain name settings.

2. WordPress Click-to-deploy instructions


If you’re using the Click-to-Deploy version of WordPress on Google Cloud, you can configure your domain settings directly through your WordPress Dashboard, by going to Settings > General.

In the URL fields, make sure to enter the preferred URL for your website. This can be either www.yourdomain.com or yourdomain.com. The important thing is to choose a preferred version and stick to it.

Also, if you’ve already configured SSL for your website, make sure the domain name you enter is preceeded by https:// instead of http://.


change wordpress settings


To change your preferred WordPress URLs, navigate from your WordPress dashboard to Settings > General.


Next, make sure to verify your website’s permalink structure. This setting often get corrupted after changing your domain name settings. You can access your permalink settings by going to Settings > Permalinks.

change permalink structure


Make sure to verify your permalink structure after changing your domain name settings.


That’s it!

Now that you’ve configured your WordPress domain name on Google Cloud, the next step is to configure an SSL certificate for your website (Bitnami or Click-to-deploy).

If you’ve already configured SSL for your website, then you can take advantage of Cloudflare’s free CDN by following this tutorial here.

If you have any questions or comments, please post them below!

Thanks,

Comments

Popular posts from this blog

Transfer Copy of WordPress Website to Google Cloud Platform