observablehq / framework

A static site generator for data apps, dashboards, reports, and more. Observable Framework combines JavaScript on the front-end for interactive graphics with any language on the back-end for data analysis.
https://observablehq.com/framework/
ISC License
2.56k stars 122 forks source link

Clean URLs and Apache httpd: use .htaccess #1822

Closed Martien closed 1 week ago

Martien commented 1 week ago

By default, Framework generates “clean” URLs by dropping the .html extension from page links.

If you want Apache’s httpd accept clean URLs, add the following to .htaccess in dist:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L]

Maybe add this to the tip?

Fil commented 1 week ago

Thanks for the suggestion, but it seems out of scope. We can't document everything that Framework interoperates with: HTML, CSS, DuckDB, node modules, etc.

Things that are adjacent to Framework and not documented in a good way anywhere else can however go into the Q&A (or tips & tricks) section of the community discussions? Do you think it's the case for this tip?

Martien commented 1 week ago

I agree. It’s something I ran into. Took me some time to figure out and fix. Maybe of help to others., yet don’t know if it is. Apache has 10+% market share. Maybe FAQ is best place. Discussions maybe too specific?

Anyway, put it where you think it makes most sense or just ignore it.