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

已提問 3 個月前檢視次數 207 次
1 個回答
1
已接受的答案

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
已回答 3 個月前
profile picture
專家
已審閱 2 個月前
profile picture
專家
已審閱 3 個月前
  • 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. :)

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南