Fix 403 errors on direct URL access to subpages#37
Merged
Conversation
Add .htaccess with Apache rewrite rules to map clean URLs to their corresponding .html files. Without this, accessing paths like /smart-contracts/ returns 403 because VuePress generates smart-contracts.html but no smart-contracts/index.html.
Rule 1: /path -> internally serves /path.html (no redirect visible) Rule 2: /path/ -> 301 redirect to /path.html (trailing slash fallback)
f985892 to
4a4bcf6
Compare
One rule covers both /path and /path/: capture path without optional trailing slash, check if matching .html exists, internally rewrite. URL stays clean - no visible redirect, no .html exposed in browser.
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.
Summary
.htaccesswith Apache rewrite rules to fix 403 errors on direct URL access.htmlfile and a same-named subdirectoryProblem
VuePress generates e.g.
positions.htmlalongside apositions/directory (for child pages). When Apache receives/positions, it sees the directory first and returns 403 (noindex.htmlinside). This affects/positions,/reserve, and/smart-contracts.How the rules work
/path→ Apache mod_rewrite catches this before mod_dir, internally serves/path.html(no redirect visible to user)/path/→ 301 redirect to/path.html(trailing slash fallback)Why .htaccess instead of directory restructure
This repo is an active fork of d-EURO/documentation with regular upstream syncs. Restructuring files (
positions.md→positions/README.md) would cause merge conflicts on every future sync. The.htaccessapproach is a single file addition with zero impact on content files or upstream compatibility.Test plan
.htaccessis deployed via FTP/smart-contracts,/positions,/reservereturn 200 instead of 403/smart-contracts/functions,/positions/openstill work/overview,/savings) unaffected