Skip to content

Fix 403 errors on direct URL access to subpages#37

Merged
TaprootFreak merged 3 commits into
developfrom
fix/htaccess-clean-urls
May 12, 2026
Merged

Fix 403 errors on direct URL access to subpages#37
TaprootFreak merged 3 commits into
developfrom
fix/htaccess-clean-urls

Conversation

@TaprootFreak

@TaprootFreak TaprootFreak commented May 8, 2026

Copy link
Copy Markdown

Summary

  • Add .htaccess with Apache rewrite rules to fix 403 errors on direct URL access
  • Generic solution: automatically handles any VuePress page that has both a .html file and a same-named subdirectory

Problem

VuePress generates e.g. positions.html alongside a positions/ directory (for child pages). When Apache receives /positions, it sees the directory first and returns 403 (no index.html inside). This affects /positions, /reserve, and /smart-contracts.

How the rules work

  1. /path → Apache mod_rewrite catches this before mod_dir, internally serves /path.html (no redirect visible to user)
  2. /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.mdpositions/README.md) would cause merge conflicts on every future sync. The .htaccess approach is a single file addition with zero impact on content files or upstream compatibility.

Test plan

  • Verify CI build succeeds and .htaccess is deployed via FTP
  • After DEV deploy: /smart-contracts, /positions, /reserve return 200 instead of 403
  • /smart-contracts/functions, /positions/open still work
  • Client-side SPA navigation unaffected
  • Normal pages without subdirectories (/overview, /savings) unaffected

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)
@TaprootFreak TaprootFreak force-pushed the fix/htaccess-clean-urls branch from f985892 to 4a4bcf6 Compare May 8, 2026 08:45
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.
@TaprootFreak TaprootFreak marked this pull request as ready for review May 12, 2026 21:46
@TaprootFreak TaprootFreak merged commit d3478d0 into develop May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant