10 ms·
For anyone who is hosting .html files and doesn't want to have to put index files inside directories, the "trick" with s3 is to rename the file to the name with
by davidweatherall 7y ago
For anyone who is hosting .html files and doesn't want to have to put index files inside directories, the "trick" with s3 is to rename the file to the name without the html extension, and change the Content Type to text/html.
Earlier today I modified the popular jakejarvis s3 sync github action to allow for this during my CI/CD process.
https://github.com/davidweatherall/s3-sync-action https://github.com/davidweatherall/s3-sync-action
- tomcam 7y agoThanks for sharing that. Nice repo! Can you explain why I wouldn't want an index file in a directory? I assume you mean index.html?
- davidweatherall 7y agoI do mean index.html! Personally I prefer the url structure of example.com/about as opposed to example.com/about/ - especially when adding on anchors or parameters (example.com/about?param as opposed to /about/?param). Relative pathing can be useful depending on file structure. It avoids issues with directory / page naming conflicts. E.g. my images are stored at /assets/img/image.png - but if I wanted to create a page at example.com/assets this would require me to then place an index.html inside my assets directory - which doesn't seem logical. Overall, mostly personal preference of me disliking the index.html inside directory method - It just doesn't seem like it's the "right" way to access a page. If I have a example.com/about page - I expect them to be hitting an about.html file.
- ____hacker____ 7y agoI feel dumb after reading this. So easy. Thank you.
- datashaman 7y agoVendor lock-in is real - why not just generate an index.html file? Then you don't need to hack anything and your files are portable. index.html will work anywhere.