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

gefragt vor 3 Monaten207 Aufrufe
1 Antwort
1
Akzeptierte Antwort

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
beantwortet vor 3 Monaten
profile picture
EXPERTE
überprüft vor 2 Monaten
profile picture
EXPERTE
überprüft vor 3 Monaten
  • 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. :)

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen