Configure 301 Redirects for Websites on Google Cloud (Apache)

July 28, 2017Leron AminComments Open

If you want to redirect webpages on your website to a new location (URL), your best option is to configure a 301 redirect.

In this tutorial you will learn how to properly configure 301 redirects for websites running on Google Cloud Platform.

Before starting this tutorial, you should have already deployed a website on Google Cloud Platform.

So let’s get started.

1. Connect to VM Instance

google cloud mennu
Go to your Google Cloud homepage and click the hamburger menu in the upper left-hand corner.
ssl certificate for wordpress on google cloud go to compute engine then vm instances
Go to your Compute Engine, then to VM instances to access your VM instance.
ssl certificate setup for wordpress on google cloud
Click on the SSH button to connect to your web server.

2. Open Apache Config File

In this example I am going to redirect eborchids.com/post1 to eborchids.com/post2.

google cloud apache2 configuration file
The first step is to open your Apache configuration file. The command used to open your Apache config file will vary depending on your software configuration.

For most web projects, run the following command:

sudo nano /etc/apache2/apache2.conf

For Bitnami web projects, run the following command:

sudo nano /opt/bitnami/apps/wordpress/conf/httpd-app.conf

3. Edit Apache Config File

google cloud apache 301 redirect
After you’ve opened your Apache configuration file, scroll to the bottom of the page and paste the 301 redirect command.

To redirect eborchids.com/post1 to eborchids.com/post2

Redirect 301 /post1 https://eborchids.com/post2

4. Restart Apache

For changes to take effect, restart your Apache server.

For most web projects, run the following command:

sudo service apache2 graceful

For Bitnami web projects, run the following command:

sudo /opt/bitnami/ctlscript.sh restart apache

Did it Work?

Make sure to test your 301 redirect to ensure that they’re configured properly.

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

Up Next…

google cloud ftp setup filezilla
Manage WordPress Files on Google Cloud Platform (Beginner)
manage wordpress files on google cloud
Manage WordPress Files on Google Cloud Platform (Advanced)

Leave a Reply

Your email address will not be published. Required fields are marked *

Made with by

© 2020 One Page Zen Systems, LLC  
Legal  |  Privacy Policy  |  Affiliate Disclosure  |  Contact  

Join our Mailing List!

Exclusive early access to the latest tutorials

Monthly update with a list of upcoming tutorials

Special access to members-only events and webinars