9

I've recently set up a new Google Cloud Platform instance to host my WordPress sites. I'm currently running around 4 sites total on the box and things have been working great so far (although there's been a huge learning curve!).

I'm basically at the end of my WordPress migration but am now having an issue with Permalinks. The WordPress custom URL permalinks that are available in the settings page simply don't work for me. When I change it to anything other than the default, I get a 404 when I try to navigate to the pages.

I did a lot of research online and discovered that this likely has to do with the .HTACCESS file and making sure that I have the proper settings for it. The issue is that GPC doesn't use .htaccess and instead uses another file called app.yaml. I have been unable to find anything online about how to configure this to work with my WordPress permalinks!

Does anyone know how to do this?

Thanks in advance.

W.Ambrozic
  • 86
  • 1
  • 2
  • 12
alexforyou
  • 93
  • 1
  • 4

4 Answers4

17

Connect to your instance via SSH then run the following command to open your Apache2.conf file:

sudo nano /etc/apache2/apache2.conf

Use the down-arrow key to scroll toward the bottom of the file, and locate this block of code:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

On the line that says:

AllowOverride None

Change it to:

AllowOverride All

Save and exit the file (CTRL + X, then Y, then ENTER), then restart your Apache server:

sudo service apache2 restart
johnrao07
  • 5,813
  • 3
  • 26
  • 45
0

Permalinks require mod_rewrite and .htaccess

Steps:

  1. To enable mod_rewrite in Ubuntu/Debian, you just need to write this command in terminal

    sudo a2enmod rewrite

    Restart apache2 after this by typing “service apache2 restart”

  2. Change the permissions on the .htaccess file to “chmod 666” so wordpress can update it when you switch permalink patterns from the settings page

0

I assumed you installed WordPress using the guide provided by Google on WordPress Installation

Have you read up on

There is an example on how to do it on the above link.

David Yew
  • 427
  • 5
  • 13
0

for me, I have to run sudo a2enmod rewrite and it works perfectly now