Hey @langdinah,
thanks for reaching out!
You can’t replace the structure as it is needed to make your URL structure work.
If you want to visit the page mywebsite.com/filename, the directory structure has to be filename/index.html. Otherwise, you cannot open it in a browser.
index.html is a web standard and is automatically interpreted by any browser and server, but that’s not the case if you rename it. If the file were named filename.html instead, it would download the HTML file instead of showing it in the browser.
Cloudflare Pages:
This is enforced by Cloudflare Pages (and also all other CDN-based services) – directories are always shown with a trailingslash at the end: https://community.cloudflare.com/t/removing-trailing-slash-on-static-websites/583429