Support web servers without PATH_INFO and subfolders - #29
Merged
Merged
Conversation
pageURL() always inserted a '/' after VIEW, giving ?action=view&page=/Test (leading slash in the editor title, wrong redirect after saving). Also HTML-escape page link hrefs and drop VIEW from the upload link, which produced a broken URL. Adds ViewUrlTest. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fra4GeCzm59fuM8yg5QR5a
Adds a 'Web server setup' section to INSTALL.md (PATH_INFO, VIEW, the images
link, subfolder installs, static files) and uses dirname(SCRIPT_NAME) for
BASE_URI instead of str_replace('/index.php', ...), which broke for other
script names and paths containing '/index.php'. Refs #8
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fra4GeCzm59fuM8yg5QR5a
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fra4GeCzm59fuM8yg5QR5a
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fra4GeCzm59fuM8yg5QR5a
…wiki in a subfolder W2_SUBFOLDER=/w2 tests/Server/run.sh apache|nginx installs the wiki below /w2. testUrlsInASubfolder checks that style sheet, icons, scripts and image URLs carry the prefix and are served (BASE_URI derived from the script folder). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fra4GeCzm59fuM8yg5QR5a
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fra4GeCzm59fuM8yg5QR5a
Closed
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.
This PR adds comprehensive support for web servers that don't support PATH_INFO (like nginx without proper configuration) and for W2 installations in subfolders of the web root.
Summary
W2 previously assumed PATH_INFO support for clean URLs like
/index.php/Page. This change adds aVIEWconfiguration option to use query strings instead (?action=view&page=Page), and ensures all URLs (static assets, images, page links) correctly handle subfolder installations.Key Changes
VIEW configuration option: Added
VIEWsetting inconfig.phpto support web servers without PATH_INFO. When set (e.g.,?action=view&page=), page names are appended as query values instead of PATH_INFO.URL generation fixes:
pageURL()function to handle both PATH_INFO and query string modespageLink()to properly HTML-escape URLsBASE_URI calculation: Changed from
str_replace('/index.php', '', $_SERVER['SCRIPT_NAME'])tortrim(dirname($_SERVER['SCRIPT_NAME']), '/\\')for more reliable subfolder detection.Documentation: Expanded INSTALL.md with detailed "Web server setup" section covering:
Test infrastructure:
ViewUrlTestintegration test suite for query string URL modeServerConfigTestwith subfolder and VIEW setting testsrun.shto supportW2_SUBFOLDERenvironment variable for testing subfolder installationsphp-test.inito disable opcache during server tests (allows config.php changes)nginx configuration: Updated template to support subfolder prefixes in location rules.
Implementation Details
The
pageURL()function now conditionally uses either PATH_INFO (/Page) or query string (?action=view&page=Page) format based on the VIEW setting. All page links and redirects (e.g., after saving) use this function, ensuring consistent behavior across the application.The test infrastructure can now validate both URL modes and subfolder installations by setting environment variables, ensuring the wiki works correctly in various deployment scenarios.
Fixes #8
https://claude.ai/code/session_01Fra4GeCzm59fuM8yg5QR5a