[Fix]: LimeSurvey - enable Apache mod_rewrite - #16767
Merged
michelroegl-brunner merged 3 commits intoAug 26, 2026
Merged
Conversation
The vhost sets AllowOverride All and LimeSurvey ships a root .htaccess with the rewrite rules its front controller depends on, but mod_rewrite is not enabled on a fresh Debian install and setup_php does not enable it either. Since the .htaccess wraps its rules in <IfModule mod_rewrite.c>, the block is silently skipped and requests to /rest/v1/* never reach index.php, returning 404 and breaking the new LimeSurvey editor. Fixes community-scripts#16764
CrazyWolf13
previously approved these changes
Aug 26, 2026
Member
|
can you fix the update script too? |
Containers created before the install fix have mod_rewrite disabled, and LimeSurvey updates itself through the web interface, so nothing in the existing update path would ever repair them. Enable the module from the update script and restart Apache, guarded by the mods-enabled symlink so an already working container is left alone and no service is restarted for nothing.
Contributor
Author
|
Sure, done. Since LimeSurvey updates itself through the web interface, existing containers would never get the module otherwise, so the update script now enables it and restarts Apache. It's guarded by the mods-enabled symlink, so containers that already have it are untouched and Apache isn't restarted on every run. |
asylumexp
requested changes
Aug 26, 2026
asylumexp
approved these changes
Aug 26, 2026
michelroegl-brunner
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✍️ Description
On a fresh installation Apache's
mod_rewriteis not enabled, so LimeSurvey'snew editor breaks: requests to
/rest/v1/*return HTTP 404.The vhost written by the script already sets
AllowOverride All, and LimeSurveyships a root
.htaccesscontaining the front controller rules(
RewriteCond %{REQUEST_FILENAME} !-f+RewriteRule . index.php) that routethose endpoints to
index.php. Butmod_rewriteis not part of Debian'sdefault
mods-enabledset, andsetup_phponly enablesmpm_preforkandphp${PHP_VERSION}— it never enablesrewrite.Because LimeSurvey wraps its rules in
<IfModule mod_rewrite.c>, there is noerror: the block is silently skipped, the request falls through to the
filesystem, and Apache returns a plain 404. The rest of LimeSurvey keeps working,
which is what makes this hard to spot.
The fix is a single line, matching the pattern already used by ~20 other
Apache-based scripts in this repo (e.g.
wordpress,bookstack,grocy):chown -R www-data:www-data "/opt/limesurvey" chmod -R 750 "/opt/limesurvey" +$STD a2enmod rewrite systemctl reload apache2The existing
systemctl reload apache2is left unchanged: Debian'sapache2.serviceusesExecReload=/usr/sbin/apachectl graceful, which re-readsthe configuration and re-executes all
LoadModuledirectives, so the newlyenabled module is loaded. This matches 12 other scripts here that pair
a2enmodwithreload.Testing:
shellcheck -xandbash -npass on the modified file. Theunderlying fix was confirmed on a live LimeSurvey 7.0.11 LXC (Debian 13,
PVE 9.1): before
a2enmod rewrite,apache2ctl -M | grep rewritewas empty andthe editor failed with 404s on
/rest/v1/i18n/en; afterwards the module loadsand the editor works normally. No full end-to-end run of the patched script from
scratch.
AI assistance: Claude Opus 5 (Claude Code), high reasoning effort. Root cause
and fix were identified manually while troubleshooting the live container (see
#16764); the model was used to verify the root cause against
misc/tools.funcand LimeSurvey's shipped
.htaccess, and to confirm the change matches repoconventions.
🔗 Related Issue
Fixes #16764
✅ Prerequisites
🤖 AI Assistance
AGENTS.mdand.github/agents/pve-script-creator.agent.mdas guidance, and the output has been reviewed and corrected to match those guidelines.🛠️ Type of Change
README,AppName.md,CONTRIBUTING.md, or other docs.