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

preguntada hace 3 meses207 visualizaciones
1 Respuesta
1
Respuesta aceptada

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
respondido hace 3 meses
profile picture
EXPERTO
revisado hace 2 meses
profile picture
EXPERTO
revisado hace 3 meses
  • 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. :)

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas