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

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. :)

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ