I am working on migrating a static website to Amazon S3 Cloudfront. I also have to migrate a htaccess file with over 100 entries. I thought about using AWS Cloud Front function. But I am stuck to how that might work.
If this isnt possible the next option is rewriting the htaccess rules to the JSON format for object redirect in S3.
Or is there a better way that I am not considering? Thanks
CodePudding user response:
S3 is a storage solution not a full-fledged server and it doesn't have redirect rules.
.htaccess
use case, such as
- Adding redirections for certain URLs
- Loading custom error pages, like 404 pages
- Forcing your site to use HTTPS instead of HTTP
can be handled at the CloudFront distribution settings level with custom error responses, origins, behaviors, and Lambda@edge, so you don't have to be tied up with software-specific configuration files like .htaccess
and httpd.conf
.
Familiarize yourself with Lambda@Egde Use Cases and here's a handful of Getting Started resources.