Pretty permalinks: 404 errors with pages on wp multisite

:warning: IMPORTANT, please fill the questions

We assume you are using Bitnami to deploy your application.

  • Which version of the application are you using?:
    WP Multisite 4.7.2-0

  • Please choose how you got the application: Installer (Windows, Linux, macOS), cloud image (AWS, GCE, Azure, …) or VM (VMDK, VBOX):
    cloudi mage GCE

  • Have you installed any plugin or modified any configuration file?:
    Yes. Tried to install certbot/letsencrypt, but failed at some point

  • Describe here your question/suggestion/issue (expected and actual results):

I have a Wordpress Multisite instance on GCP (micro-f1). There are five websites configured. With two of these websites I don’t encounter the following problem at all. Not sure why that is. Here’s the problem description (which is valid for all other websites, also new ones created): all pages return a 404 error after enabling pretty permalinks. Example page with error can be found here. At one time, all of these pages worked perfectly with pretty permalinks, but somehow, maybe after activating a (child)theme, the 404’s started occuring and are still here. I’ve spent the last two days troubleshooting and reading community posts (this post very much resembles my problem, but no answers seem to work). Thanks for helping me out with this.

Hi,

Could you please describe the steps you followed in order to enable pretty permalinks in your blogs? Did you recall any difference between the procedure you followed for the blogs that work and the ones that don’t?

Thank you for your kind cooperation.

Best regards,
Alvaro Recio

Hi Recio,

I’ve always used the wordpress control panel: Settings, Permalinks. I then get a message that .htaccess should be changed (but never did, as it seemed to work).

Now I noticed that for the two sites that I thought worked, when I change the current pretty permalinks to any other setting, the 404 start occuring here also. When reverting back to the original pretty permalink setting, the 404 are now permanent. So it is probably a sitewide problem. Also note that most websites have migrated wordpress content.

Thanks.
Bart

Hi,

You mentioned that you got a message that prompted you to change .htaccess. Please keep in mind that our stacks are configured to ignore that file for performance and security reasons and that you should edit htaccess.conf instead, as explained here.

Could you try performing the modifications to that file and see if it solves the issue?

Best regards,
Alvaro Recio

Hi,

Thanks, but I was aware of that. I doublechecked .htaccess and htaccess.conf, and also http-app.conf (with AllowOverride None setting). The only rewrite rule that is active, is the one in htaccess.conf:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a traling slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . /index.php [L]

Btw: in .htaccess a rewrite rule was automatically added for W3TC cache. Not sure if this could interfere with the rewrite in htaccess.conf. I have temporarily disabled W3TC.

Also, in httpd-app.conf, I removed this rewrite rule (not sure what it does, but it doesn’t seem to matter for the 404 problem):

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [S=2]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

The 404’s still occur.

Is there a way to reset all .conf files to their standard settings? It’s a dev environment, so no problem if I need to reconfigure some things.

Bart

Hi,

You may copy the rule that was added to .htaccess for W3TC to htaccess.conf to enable it on the server. That way you won’t have to disable W3TC.

There’s no automatic way to reset the .conf files back to their standard settings. Would it be acceptable to start from scratch on a new instance? We’ve tried changing the permalinks settings on a fresh instance of WordPress Multisite and it worked as expected.

Best regards,
Alvaro Recio

I migrated everything to a new instance, as suggested, and this seems to have ‘solved’ the problem with the 404’s. Fingers crossed it will stay like this.

Thanks for helping me out with this.

Hi!

We hope everything works perfectly in the new instance. Anyway, remember that if you have any other questions, please do not hesitate to let us know.

Best regards,
Carlos R. Hernández

Alas, after a week running without any problems on the new instance, the 404 issue with pages is back.

I have 5 websites on this wp multisite instance, of which all but one (reason: unclear) are returning 404’s for every page when pretty permalinks are enabled.

I didn’t change anything in the Bitnami WP Multi configuration files.

Could this have anything to do with the WP Domain Mapping plugin?

Any help is appreciated.
Thanks.

Hi @mamebart,

That is a really specific question about how WordPress and its plugins work so I suggest you ask in the official forums of the application to get more information about it. In this community forum, we provide technical support in relationship with any problem you can face related to launching one of our images, accessing it, understanding how to get the login credentials, etc,

Do not hesitate to write us back if you have any other question about any of the Bitnami solutions.

Regards,
Jota