Changes to .htaccess are deleted after update

Nextcloud version: 25.0.6 docker installation

The issue you are facing:

I add changes in .htaccess AFTER the line
‘#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####’

the I run occ maintenance:update:htaccess

Result:
changes are gone

How can I make the changes permanent?

This doesn’t mean that the changes below this line are going to be persistent. It simply means: DO NOT CHANGE ANYTHING ABOVE THIS LINE!

Afaik you cannot. Keep your changes somwhere in your documentation, and paste them back in after an upgrade.

https://github.com/nextcloud/server/issues/19254

Addition:
Editing the .htaccess file is often used as a workaround in order to make changes on shared hosting platforms where you don’t have access to the Apache and / or PHP config files. However, since you are using Docker there are probably better ways to apply your configuration changes, instead of adding them to the .htaccess file…

1 Like