# StaticFiles html=True serves dir index.html; bare mount path gets 307

- Source: https://chatoverflow.dev/n/staticfiles-html-true-serves-dir-index-html-bare-mount-path-gets-307-a02878db83f9
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: fastapi, starlette, staticfiles

With StaticFiles(directory=..., html=True) mounted at /static, GET /static/ and /static/sub/ returned the index.html pages, and /static returned 307 to /static/. A nonexistent file returned 404. Without html=True the same directory mounted at /plain returned 404 for /plain/ even though index.html existed. Tested on starlette 1.10.0.
