3

I’ve been beating my head against the wall for three weeks trying to get permalink settings in Wordpress to work on Google Cloud Platform. Here’s a quick summary of what I have, what I’m trying to do, and what I’ve already tried.

I have two servers on GCP that are both experiencing the same problem.

Server 1 (Migrated Server) This server has four Wordpress sites that I migrated from a shared hosting provider. All four of these WordPress sites have issues unless I use the first setting in the Permalinks section under Settings for WordPress. OS: Debian 8 Website: www.example.com

Server 2 (Google Deployed) This server is a single Wordpress deployment that was launched using Google’s pre-built wordpress instance deployment. OS: Debian 8 Wordpress: 4.8

The Permalinks Problem: In Wordpress -> Settings -> Permalinks -> If I chose “Plain - http://example.com/?p=123” I can load the front page of the site and navigate to any sub pages. If I choose anything OTHER than “Plain”, whether that’s “Day and name”, “Month and name”, “Numeric”, “Post name”, or “Custom Structure”, then I can only load the front page of the site and I’m unable to load any of the other pages. When I try to load any of the other pages I receive the following error:

Not Found The requested URL /loopstats/ was not found on this server. Apache/2.4.10 (Debian) Server at example.com Port 80

Now he’s the real kicker, Server 2 (GCP Deployed), which I used the Google Deployment Manager to launch the Wordpress instance, the default setting for Permalinks is the “Custom” option with the following slug:

/index.php/%year%/%monthnum%/%day%/%postname%/

Again, if I use ANY other setting other than this custom link, I can only load the front page and ALL other links are broken.

When I go back to Server 1 (Migrated Server), and I input this slug in the custom field, then everything works on the Server 1. This doesn’t work for me though as I’m now left with these incredibly nasty links that contain index.php. (I’m told this is terrible for SEO purposes).

Things I’ve tried:

  1. Days of googling. I have questions on Wordpress’s main site, some plugin sites, Reddit, and I keep coming up blank.

  2. Apache2 Rewrite: From different sites I’ve read online, I’ve found that Apache Rewrite can be the issue here if it’s not enabled. I went through and made sure this was enabled on both sites.

  3. .htaccess file: I’ve nuked the .htaccess file on Server 1 and replaced it with the .htaccess file from Server 2 (Google Deployed). This didn’t yield any benefits to the permalink structure other than allowing me to now use the Custom slug from Server 2. (/index.php/%year%/%monthnum%/%day%/%postname%/)

This is the content of my current .htaccess file on both servers:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule># END WordPress
# END Wordpress

Does anyone have any idea what I’m doing wrong? I want to be able to use better permalinks and get rid of these hugely nasty links.

MrWhite
  • 11,643
  • 4
  • 25
  • 40
alexforyou
  • 91
  • 1
  • 2
  • 9
  • Did you reload/restart Apache? – JayMcTee Aug 01 '17 at 08:55
  • Yes, I've tried reloading Apache several times. Now here is something interesting - I recently started a Wordpress instance using a Bitnami premade deployment... and strangely the bitnami deployments don't have the same problem. How can I debug what the different settings are between the two instances? – alexforyou Aug 03 '17 at 18:49
  • Please check the following link it worked for me https://randomwordpresstips.wordpress.com/2013/05/10/enabling-permalinks-on-wordpress-install-ubuntu-12-10/ – user899893 Sep 10 '17 at 10:16
  • did you solve it @alexforyou ? – johnrao07 Nov 20 '18 at 15:45

1 Answers1

8

use ssh: edit your apache .conf

sudo nano /etc/apache2/apache2.conf

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride ALL <----(edit from none)
        Require all granted
</Directory>

...and then restart apache2 using:

sudo service apache2 restart

Jonirish
  • 3
  • 2