After your WordPress installation and domain pointing on Google Cloud Server, a few steps you need to follow to configure your domain name so that it works properly with your WordPress website. I request you to take some extra time to set up your domain correctly cause if you missed some step then search engine results may be affected.
I also recommend you to reserve and configure a static IP address for your WordPress site on GCP before your domain configuration.
Ok, Now let’s get started!
There are two option available for domain configuration on WordPress, i.e., 1) Domain Configuration for WordPress Bitnami and 2) Domain Configuration for WordPress Click-to-Deploy
Domain Configuration for WordPress (Bitnami Version)
If you’re using the Bitnami version of WordPress on GCP then changing your site URLs via Settings > General option is not available. To modify your site URLs, you need to edit your wp-config.php file by connecting SSH. Follow my steps below to set up your domain for WordPress Binami Version on Google Cloud.
Step 1: Visit Google Cloud Console dashboard and click on the Navigation Menu, then under the COMPUTE section, select Compute Engine and then click on VM instances from the drop-down.
Step 2: At the VM instances page, you will see the SSH option. Now click on the SSH button to connect with your WordPress installation.
Step 3: Once you connected via SSH, type following comments and then press enter to connect as a root user and open your wp-config.php file in the nano editor.
sudo -i nano /home/investof/domains/bloggerlessons.com/public_html/wp-config.php
Step 4: Now following screen you will be able to see, and there you need to replace your SITEURL and HOME URL definitions as shown below.
Replace This Lines: define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/'); define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/'); With: define('WP_SITEURL','http://yourdomain.com'); define('WP_HOME','http://yourdomain.com');
Please Note – If you’ve already configured the SSL certificate for your domain on GCP then you need to substitute the https:// in the code below for http:// instead. For example:
Replace This Lines: define('WP_SITEURL','http://yourdomain.com'); define('WP_HOME','http://yourdomain.com'); With: define('WP_SITEURL','https://yourdomain.com'); define('WP_HOME','https://yourdomain.com');
Now replace “yourdomain.com” with your domain. If you are using sub-domain (like www or other), then don’t forget to insert it before your domain.
Step 5: Now press CTRL+X, then press Y to save the changes and for the exit. After that execute the following command below to restart your Apache server.
sudo /opt/bitnami/ctlscript.sh restart
Step 6: Login to your WordPress site and then verify your website’s permalink structure. This setting often gets corrupted after changing domain settings. You can access your permalink settings by going to Settings > Permalinks.
Step 7: Congratulations! Your domain configuration now completed for WordPress Bitnami on Google cloud.
Domain Configuration for WordPress (Google Click to Deploy Version)
If you’re using the Click-to-Deploy version of WordPress on Google Cloud Platform, then you can configure your domain settings directly through your WordPress Dashboard. Follow my steps below to set up your domain for WordPress Click-to-Deploy on Google Cloud.
Step 1: Visit your WordPress Dashboard area and then click on Settings > General option to edit your WordPress Address(URL) or Site Address(URL) preference. It can be either www version of your domain (example-www.yourdomain.com) or just your domain (example-yourdomain.com). So, choose your preferred version and then save.
Step 2: Now, click on Settings > Permalinks option to check your website’s permalink structure. Make sure to verify your permalink structure after changing your domain settings cause this setting sometimes gets corrupted after changing domain settings.
Step 3: You’re Done!
If you face any trouble during domain configuration for WordPress then please let me know by commenting below.