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.
- How to Create a Project on GCP
- How to Change Project Name on GCP
- How to Deploy WordPress on GCP
- How to Change phpMyAdmin Password
- How to Change WordPress Admin Password
- How to Enable Cloud DNS API on GCP
- How to Create Cloud DNS Zone on GCP
- How to Reserve Static IP Address on GCP
- How to Fix WordPress Permalink Issue on GCP
- How to Set Up Domain Name with GCP
- How to Set Up FTP with FileZilla on GCP
- How to Change Machine Type on GCP
- 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;
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.