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/celebspl/bloggerlessons.com/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!
That’s it!
If you face any trouble during domain configuration for WordPress then please let me know by commenting below.
Hi Chiranjit, This actually worked well for me on a few of my other builds. But as of this last week of July 2019..After following the steps Bitnami server does not reboot when following commands above to restart Apache. Then when you go to log into WP to change permalinks you get Error 500 if your lucky..but either way your locked out. My first few times.. smh I didnt snapshot or backup.. but this time I did.. I wanted to let you know something isn’t working here any longer.
Please let me know if you find a fix … I ll test it out for you.
Hello Jonathan, I did not face any issue during setup and configuration. I tested it last time, like 2 weeks ago. Did you follow all the steps properly? i.e., a static IP reservation, domain setup on GCP? Please let me know.
I wanted to add to the comment I just left.. there is nothing wrong with the code above.. it is something wrong with Googles VM servers, not writing to the htaccess.file / Therefore you have to go in and enable it after trouble shooting ..here is a great link that helped me
https://studiok40.com/so-your-permalinks-in-wordpress-arent-working-on-a-google-cloud-instance/
yes bhai, i am facing problem. my website is not opening. should i wait for 24 hours. i want to send you screenshots. will you help me?
Thanks for contacting me! Join me on Bloggerlessons FB Page. We can discuss your issue there and can help you to solve your problem. Thank you 🙂
Thank you dear, my site is working now. i would love to join your fb page.
now my admin page is not open after all done
What Problem you are facing? Could you please explain a bit? You can also join me on chat section for getting help.