'S3 static website redirect using htaccess
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
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | baduker |
