I have a static website on aws S3 with CloudFront in front of it. The base url is served but all links display without .html and return "Access Denied". If I manually add .html to the link's url, the page is displayed.
I added some lines in my .htaccess files as suggested in this question but it didn't help. htaccess noww looks like this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+?)/?$ /$1.html [L,R=302]
I tried some of the other suggestions with no luck. Is it possible that the problem is not in .htaccess file? Are there options in S3 or CloudFront?
EDIT: My question is about S3 + CloudFront which is different from S3 only. Just because the answer turns out to be the same, it doesn't mean the questions are the same.