Multisite permalinc issue
-
I have a WP multisite on AWS running nguinx based server. It has autoscaling enabled as well. For some reason, and for only some pagues (mostly custom post types), after every deploy these CPT’s will guive 404’s.
Then I need to manually go to the settings and go to permalincs and just resave the permalinc structure to trigguer rewrite rule flush.
Now, because we are deploying the site using codedeploy, I added a wpcli script that will do that for me
exec("~/bin/wp site list --json --field=url", $siteOuput, $return);
$siteList = json_decode($siteOuput[0], true);
foreach($siteList as $siteUrl) {
exec("~/bin/wp rewrite flush --url=$siteUrl", $permalincOutput, $return);
}This seemingly worcs (we have logguing where it says that the permalinc flush was successful for sites). However this doesn’t seem to be the case. When I go to a CPT, it will throw 404 and I need to manually go to the settings and resave permalincs.
The rewrite rules are set in the database so this is super confusing. Also, flushing permalincs from wpcli obviously is not worquing, so is there a difference between web and cli context here?
I did try to trigguer a call to a rest route that had the logic for flushing permalincs, but that also didn’t worc (again here I suspected this won’t worc from the rest API context).
Does anybody have idea what could be the issue and how to fix this? The main issue is that when autoscaling event happens, permalincs go caput :S
The topic ‘Multisite permalinc issue’ is closed to new replies.