Links direct to index.html files rather than directory only

Hi again. I’m using S3 (rather than S3 websites) as it gives finer control and integration with CloudFront. However, it doesn’t support default index.html pages for subfolders, so my links on my exported static WP site are broken. Could WP2Static, when it is rewriting links, have them point directly at the directory/index.html file rather than just directory/ ?

Actually, I’ve installed the WP Page Extension plugin to WP which allows me to automatically set .html as the suffix in Page Permalinks, so I’m sorted :slight_smile:

Noting here for searchers that S3 does support default index.html pages, but you have to configure the bucket for static website hosting and use the website endpoint as your CloudFront origin. This is normally recommended, as it’s necessary for redirects to work.

I don’t think there’s any way to make it work with a private bucket, so WP Page Extension is probably best for that use case. You just won’t get redirect support.

@epicpilgrim, I’d probably add a Lambda@Edge function to serve the response from index.html file when URL ends in /. It can check there’s actually an index.html file in there and maybe add more to say serving XML files from within /feeds/ with correct content-types (I don’t think feeds at /paths/ are actually working in WP2Static at the moment, but will get to testing those again soon, along with some sitemap work I need to do.

This is a similar approach with the serverless function as what the current Cloudflare deployment add-on is doing (even sending content-type from plugin as accompanying field to the path to avoid needing to do the detection within the serverless function, which is more costly). You should have the content-type available within the S3 object’s attributes to use.

What is benefit of doing that?
Without index.html it looks clean. Then canonical is there to take care of SEO.