feat(pantheon): add support for root-level WordPress installations #15
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
Teamwork Ticket(s): Pantheon Root-Level WordPress Support
This PR adds comprehensive support for Pantheon sites that have WordPress installed at the application root level instead of in a
web/subdirectory. This is common for older Pantheon sites or sites migrated from other hosting providers. The changes introduce a configurableDOCROOTenvironment variable that can be set to an empty string for root-level installations, and updates all commands, nginx configuration, and scripts to handle both modern (web/) and legacy (root) directory structures.Acceptance Criteria
ddev project-configure) prompts for document root with clear guidance for modern vs. legacy sitesweb/subdirectory and root-level WordPress paths correctly:project-initchecks mu-plugins at correct pathproject-wpuses correct docroot paththeme-activatereferences correct theme pathrefresh-pantheon.shnavigates to correct directory{{DOCROOT}}placeholder that gets replaced with actual path duringproject-configure/var/www/htmlfor empty docroot or/var/www/html/webfor configured subdirectoryinstall.yamlpost-install actions handle wp-config.php and mu-plugins at correct paths for both configurationsweb/subdirectory continue working without changes (backward compatible)Assumptions
wp-config.php,wp-content/,wp-includes/, andwp-admin/at the repository rootweb/as the recommended docrootDOCROOTenvironment variable can be set to empty string ("") or omitted entirely to indicate root-level installationddev project-configurewill be prompted to enter the correct docroot for their site structureSteps to Validate
Test 1: New Project with Root-Level WordPress (Legacy)
ddev project-configure # When prompted for docroot, press Enter without input or type ".".ddev/config.yamlshowsdocroot: ""ordocroot:.ddev/nginx_full/nginx-site.confhasroot /var/www/html;(no subdirectory)Test 2: New Project with web/ Subdirectory (Modern - Default)
ddev add-on get kanopi/ddev-kanopi-wp ddev project-configure # When prompted for docroot, enter "web" or accept default.ddev/config.yamlshowsdocroot: web/var/www/html/webas rootTest 3: Existing Project Migration (Backward Compatibility)
web/subdirectoryTest 4: Integration Test Suite
Run the new integration test:
bats tests/test.bats -f "pantheon root-level wordpress configuration"Affected URL
Local DDEV test environments
Deploy Notes
Configuration Files Changed
.ddev/config.yaml: NewDOCROOTenvironment variable for Pantheon projects (empty string for root, "web" for subdirectory).ddev/scripts/load-config.sh: AddedDOCROOTexport for Pantheon provider with empty string default.ddev/nginx_full/nginx-site.conf: Changed from hardcoded/var/www/html/webto template placeholder{{DOCROOT}}that gets replaced during configurationCommands Modified
commands/host/project-configure: Added docroot prompt for Pantheon projects, normalizes empty/dot input, updates nginx configuration with correct root pathcommands/host/project-init: Handles mu-plugins path based on DOCROOT configurationcommands/host/project-wp: Determines correct docroot path for WordPress installationcommands/web/theme-activate: Uses configured DOCROOT for theme path resolutionscripts/refresh-pantheon.sh: Navigates to correct directory based on DOCROOT valueInstallation Actions Modified
install.yaml: All post-install and removal actions updated to handle empty DOCROOT:Testing Added
tests/test.bats: New test case "pantheon root-level wordpress configuration" validates complete workflow for empty docrootDocumentation Updates
README.md: Added Docroot column to hosting provider comparison tableCLAUDE.md: Updated Pantheon section with root-level WordPress support notedocs/providers/pantheon.md: Added comprehensive section on WordPress installation locations, configuration examples, troubleshooting 404 errors, and migration guidancePost-Deployment Actions Required
For New Projects:
ddev project-configureto set up DOCROOT variableddev restartto apply nginx configuration changesFor Existing Projects:
web/subdirectory continue working without changesddev project-configureto explicitly set DOCROOT in environment variablesBreaking Changes
None - this is a backward-compatible enhancement. Existing projects with
web/subdirectory continue working without modification.🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com