Allow `.htaccess` customization and keep changes on updates
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
.htaccess customization lost after every update
Steps to reproduce
- get notification about new version, login in my NC web as admin and check
- run in server console 'sudo -u www-data php /var/www-nextcloud/updater/updater.phar'
- update goes smooth and ends "Update of code successful" and then runs "occ upgrade", which ends with "Update successful"
- but then I get 500. error, because setup deletes '.htaccess' customization:
<FilesMatch .php>
# Apache 2.4.10+ can proxy to unix socket
SetHandler "proxy:unix:/var/run/php/php8.3-fpm.sock|fcgi://localhost/"
which is BELLOW:
DO NOT CHANGE ANYTHING ABOVE THIS LINE
default PHP on server is 8.4, which is not yet supported
after re-adding my '.htaccess' customization, NC runs great
Expected behavior
anything bellow
DO NOT CHANGE ANYTHING ABOVE THIS LINE
remains in .htaccess
Nextcloud Server version
30
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.3
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Updated from a MINOR version (ex. 32.0.1 to 32.0.2)
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
sudo -u www-data php occ config:list system
{
"system": {
"auth.bruteforce.protection.enabled": true,
"force_language": "en",
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"nextcloud.ieleja.lv"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"overwrite.cli.url": "https:\/\/nextcloud.ieleja.lv",
"dbtype": "mysql",
"version": "30.0.7.2",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"memcache.local": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 6379
},
"memcache.locking": "\\OC\\Memcache\\Redis",
"updater.release.channel": "stable",
"maintenance": false,
"ldapIgnoreNamingRules": false,
"ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
"theme": "",
"loglevel": 3,
"mail_smtpmode": "smtp",
"mail_sendmailmode": "smtp",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mysql.utf8mb4": true,
"default_phone_region": "LV",
"maintenance_window_start": 1
}
}
List of activated Apps
sudo -u www-data php occ app:list
Enabled:
- activity: 3.0.0
- app_api: 4.0.6
- calendar: 5.1.3
- circles: 30.0.0
- cloud_federation_api: 1.13.0
- comments: 1.20.1
- contactsinteraction: 1.11.0
- cookbook: 0.11.3
- dashboard: 7.10.0
- dav: 1.31.1
- federatedfilesharing: 1.20.0
- federation: 1.20.0
- files: 2.2.0
- files_downloadlimit: 3.0.0
- files_pdfviewer: 3.0.0
- files_reminders: 1.3.0
- files_sharing: 1.22.0
- files_trashbin: 1.20.1
- files_versions: 1.23.0
- firstrunwizard: 3.0.0
- logreader: 3.0.0
- lookup_server_connector: 1.18.0
- nextcloud_announcements: 2.0.0
- notes: 4.11.0
- notifications: 3.0.0
- oauth2: 1.18.1
- password_policy: 2.0.0
- photos: 3.0.2
- privacy: 2.0.0
- provisioning_api: 1.20.0
- recommendations: 3.0.0
- related_resources: 1.5.0
- serverinfo: 2.0.0
- settings: 1.13.0
- sharebymail: 1.20.0
- support: 2.0.0
- survey_client: 2.0.0
- systemtags: 1.20.0
- tasks: 0.16.1
- text: 4.1.0
- theming: 2.6.0
- twofactor_backupcodes: 1.19.0
- updatenotification: 1.20.0
- user_status: 1.10.0
- viewer: 3.0.0
- weather_status: 1.10.0
- webhook_listeners: 1.1.0-dev
- workflowengine: 2.12.0
Disabled:
- admin_audit: 1.20.0
- audioplayer: 3.4.1 (installed 3.4.1)
- bruteforcesettings: 3.0.0 (installed 2.4.0)
- encryption: 2.18.0
- facerecognition: 0.9.60 (installed 0.9.60)
- files_external: 1.22.0
- files_rightclick: 0.15.1 (installed 1.6.0)
- keeweb: 0.6.20 (installed 0.6.20)
- recognize: 8.2.0 (installed 8.2.0)
- suspicious_login: 8.0.0
- twofactor_nextcloud_notification: 4.0.0
- twofactor_totp: 12.0.0-dev
- user_ldap: 1.21.0 (installed 1.21.0)
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
there are not entries in LOGs about .htaccess
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the update with updater/updater.phar and inspect how the .htaccess file is handled before and during occ upgrade. Compare the expected preservation of content below "DO NOT CHANGE ANYTHING ABOVE THIS LINE" with the current result; done means the customization survives a minor update without causing the reported Apache/PHP 500 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- apache, mariadb, php
- Domain
- backend, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100