Flush Permalinks not working

Keywords: WordPress - AWS - Technical issue - Other
bnsupport ID: a63a64d1-e212-dbd6-f687-f7a269d9e10b
Description:
Site Health was reporting a consistent need to flush permalinks. Flushing permalinks from the admin console appears to do nothing, even when changing settings. I added the following line to functions.php, which appears to have solved the issue.

flush_rewrite_rules();

My concern is that this appears to be a relatively heavy handed approach to solving the issue. Is there a better way to trace the issue regarding headers not being written correctly and permalinks not flushing via the admin console, as the system is designed?

Site: www.epicural.com
Bitnami Debian 5.7-2 Wordpress
Hosted on AWS
Linux ip-172-31-78-80 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux

Hi @rka,

Did you follow the steps described here?

https://wpastra.com/docs/how-to-refresh-wordpress-permalinks/

Regards,
Michiel

Absolutely followed those very simple instructions. I have flushed permalinks dozens and dozens of times. It has no effect, which is why I’m asking the question. Why isn’t it working? Is it a setting or permissions issue?

Hi @rka,

It doesn’t seem related to permissions. Can you try to flush the pagespeed cache?

https://docs.bitnami.com/bch/apps/wordpress/administration/use-pagespeed/#flush-the-pagespeed-cache

Regards,
Michiel

I executed the cache flush, and restarted Apache. Still getting the error.

I checked by commenting out the "flush_rewrite_rules(); line I added to functions.php. As soon as I removed, it, flushed the pagespeed cache, and restarted apache (in that order) I am seeing the error again

Hi @rka,

Did you add any custom rewrite rules? The Apache log shows the following error:

[Tue Apr 27 12:21:44.626313 2021] [core:error] [pid 30774:tid 140348575667968] [client ***********:36899] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

It could be due to a rewrite misconfiguration that the permalinks flushing is only working when you flush the rewrite rules first.

Regards,
Michiel

I don’t think I did. Can an app do that? Its a pretty vanilla WordPress site running Avada theme.

How do I check for rewrite rules?

Hi @rka,

In the /opt/bitnami/apps/wordpress/conf/httpd-app.conf these rewrite rules have been added:

RewriteEngine On
#added by Bob
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
#add complete
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /

Can you change it back to the original rules?

For reference you can find the original file in /opt/bitnami/bnsupport/original-data/apps/wordpress/conf/httpd-app.conf

Regards,
Michiel

Michiel, I changed it back. I forgot I had done that. I also removed a change I made to httpaccess.conf that was there to fix a font issue I was having. I tried to get everything back to “stock” but I’m still seeing the flush permalinks issue.

I changed the /opt/bitnami/apps/wordpress/conf/httpd-app.conffile back to original configuration.
I then restarted apache.
I then flushed pagespeed cache.
I the restarted apache.
I then flushed permalinks.
I then restarted apache.
Still getting the issue.

Hi @rka,

Weird, can you run the bnsupport tool again? I will try to reproduce the issue.

Regards,
Michiel

Michiel, here is the bnsupport-tool output

5612a201-010b-2cb5-369b-162388258885

rka

Hi @rka,

I haven’t been able to reproduce the issue using a new instance. Can you try to reset the permissions of /opt/bitnami/apps/wordpress/htdocs/?

https://docs.bitnami.com/general/apps/wordpress/administration/understand-file-permissions/

Regards,
Michiel

Michiel, I reset htdocs to 775, but the error persists.

Ran all these commands, focused on wordpress directory.

sudo chown -R bitnami:daemon TARGET
sudo find TARGET -type d -exec chmod 775 {} \;
sudo find TARGET -type f -exec chmod 664 {} \;
sudo chmod 640 TARGET/wp-config.php