How to show a page without .html in the end (s3 static website + Cloudfront)

0

I have a website using s3 static website + Cloudfront ex: welcome.net , i have set up an index.html file as a landing page. I have uploaded a file ex: groups.html to the same bucket. I can only access the website if I type welcome.net/groups.html and I want to make sure it can also be accessible through welcome.net/groups (without .html).

I have set this inside bucket redirection rules:

{

"RoutingRules": [ { "Condition": { "KeyPrefixEquals": "groups" }, "Redirect": { "HostName": "welcome.net", "HttpRedirectCode": "301", "Protocol": "http", "ReplaceKeyPrefixWith": "groups.html" } } ] }

and I am getting this error when i try to save it:

Unknown Error An unexpected error occurred. API response Expected params.WebsiteConfiguration.RoutingRules to be an Array

Anyone knows how to get this done? Than you so much in advance

asked 2 months ago190 views
1 Answer
1
Accepted Answer

What happens if you shorten it to this?

[
    {
        "Condition": {
            "KeyPrefixEquals": "groups"
        },
        "Redirect": {
            "HostName": "welcome.net",
            "HttpRedirectCode": "301",
            "Protocol": "http",
            "ReplaceKeyPrefixWith": "groups.html"
        }
    }
]

If this solves the issue, please choose this as the Accepted Answer so others on re:Post may benefit - Thank you

profile pictureAWS
answered 2 months ago
profile picture
EXPERT
reviewed a month ago
profile picture
EXPERT
reviewed 2 months ago
  • Thanks a lot, that works. The code I provided was filled with placeholders so just did what you suggested and added https to my real code and it is working like I wanted. :)

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions