Closed dingledow closed 9 years ago
A quick google search found some good answers for me!
http://stackoverflow.com/questions/23463679/s3-static-pages-without-html-extension
In a multipage web app with about 12 pages, manually editing the file extension and format is inefficient for on every upload.
An automated and worry-less strategy is to use AWS Lamda@Edge. It solves this completely.
First, create an AWS Lambda function and then attach your CloudFront as a trigger.
In the code section of this AWS Lamda page, add the snippet in the repository below.
https://github.com/CloudUnder/lambda-edge-nice-urls/blob/master/lambdaRewrite.js
Content delivery will still be as fast as you can blink your eyes.
PS: Note the options in the readme section of the repo above
Hope this helps!!
The better approach is to use Lambda@Edge and handle the request to the correct object.
I know
clean_urls
can be set in the app.coffee file to remove the.html
extension when runningroots watch
locally. However, I need to deploy the/public
directory to Amazon S3 to host the site and to have clean URLs, I would have to set the meta data of the fileContent-type
totext/html
AND rename the file removing the.html
from the end.Is there a way that the
/public
compiled build could have each page created so it is anindex.html
file inside a directory with the name of the page. An example of this may be for a contact page:Rather than:
/public/contact.html
-->/public/contact/index.html
So the browser would show
exmaple.com/contact/
instead ofexample.com/contact.html
Any suggestions would be much appreciated.