If this is the first time you start hosting your WordPress site on Google Cloud Platform, changing permalinks structure will cause all your posts to be 404 not found. This because you need to allow the .htaccess file to overwrite in the Apache configuration.
Don’t worry, it’s not that difficult and can be done in just a couple minutes!
Editing Apache Config
1) Let’s start with open SSH connection to your VM instance by clicking the SSH button on Google Computing Engine Dashboard.
2) Then open apache.conf file using this command
$sudo nano /etc/apache2/apache.conf
3) File will be opened in the editor.
Use Down Arrow to find the block below
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
4) Change this line
Then save the file by pressing CTRL+X, type y and enter.
5) Enable mod_rewrite by type the command below
$ sudo a2enmod rewrite
6) Done! Restart the Apache server using this command
$ sudo service apache2 restart