How to Fix WordPress Permalink Issues on Google Cloud Platform

WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. However, you may find problems when you try to change the permalinks.

  1. How to Create a Project on GCP
  2. How to Change Project Name on GCP
  3. How to Deploy WordPress on GCP
  4. How to Change phpMyAdmin Password
  5. How to Change WordPress Admin Password
  6. How to Enable Cloud DNS API on GCP
  7. How to Create Cloud DNS Zone on GCP
  8. How to Reserve Static IP Address on GCP
  9. How to Fix WordPress Permalink Issue on GCP
  10. How to Set Up Domain Name with GCP
  11. How to Set Up FTP with FileZilla on GCP
  12. How to Change Machine Type on GCP
  13. How to Delete a Project on GCP

For example, when you change the permalinks from "Custom Structure" to "Post name", you will get 404 errors when you open the pages or posts. Please follow the steps below to fix the permalink issues.

Part I: Add Member and Role

Step 1: Login the Google Cloud Platform and click the menu icon on the left-top corner in the dashboard;

This image has an empty alt attribute; its file name is gcpdeploywordpress001.jpg

Step 2: Click "Compute Engine" from the left menu, and select "VM instances" from the list;

Step 3: On the top-right of the page, click "Add" to add member;

Step 4: Add your email address and select a role. This is to give permission to yourself to edit the files;

Part II: Work with .htaccess file

Step 5: Click on "SSH", or click the triangle after SSH, and then click "Open in browser window" from the list;

Step 6: In the new window, copy the command below to enable mod_rewrite in Apache;

sudo a2enmod rewrite

Step 7: Copy the command below to open the files;

sudo nano /etc/apache2/apache2.conf

Step 8: Use the down arrow to move the cursor almost the end of the file, and change from "None" to "All" under the <Directory /var/www/>

Step 9: Press "Ctrl+X" to exit the window, and press "Y" from the keyboard to save the changes.

Step 10: Press "Enter" to close the file, and use the following command to restart the server. The permalinks should be good to change now.

sudo service apache2 restart

Go back to your website and change the permalink style, you should have no issues to open the pages anymore.

Leave a Reply