Best Practices for Extensionless URLs and Shared Headers/Footers in Static HTML
Migrating from WordPress to Static HTML: Key Challenges
When migrating a website from WordPress to static HTML hosted on Nginx, two critical architectural challenges arise: preserving your established extensionless permalink structure (e.g., /partnerships/) for SEO continuity, and managing reusable components like headers and footers without harming performance or search visibility.
While client-side JavaScript fetching (such as fetch('header.html')) might seem convenient, it triggers Cumulative Layout Shift (CLS), degrades initial page render time, and relies on search engine bots executing JavaScript reliably. To serve fully rendered HTML on the initial HTTP response, you must choose the right server-side configuration and component assembly strategy.
1. URL Structuring: Directory-Based vs. Nginx try_files
Preserving clean URLs without creating duplicate content or infinite redirect loops is essential for maintaining search engine rankings.
Option A: Server-Level Rewrites with try_files
Using flat files like /partnerships.html along with Nginx's try_files directive allows you to keep a flat file directory on your server: