Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress permalinks on Google Cloud Platform don't work

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.

like image 327
alexforyou Avatar asked Jun 13 '17 20:06

alexforyou


People also ask

Why are my permalinks not working in WordPress?

The simplest way to deal with this problem is by resetting the permalinks structure: Login to your WordPress Dashboard. Go to Settings > Permalinks. Select an alternative permalinks structure -> Save Changes.

Why is the permalink not working?

Reasons why permalink might be brokenYour program files may be disrupted by the installation of a new plugin. A corrupted permalink might occur when restoring backup files or moving WordPress to a different server or domain. There may be a lack of correlation once you upgrade a plugin, resulting in a 404 error.


1 Answers

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
like image 86
johnrao07 Avatar answered Oct 19 '22 03:10

johnrao07