How can I make Nuxt.js accept both `/` and `/index.html` URL?

Viewed 1682

I'm using Nuxt.js default mode, universal and history router.

When I run nuxt generate and get a website, Nuxt.js generates index.html in dist folder.

So if I publish the website, I can simply access my website via https://example.com/.

Here comes my question, if I navigate to https://example.com/index.html, Nuxt.js immediately redirect my website to:

This page could not be found
Back to the home page

If I disable my browser JavaScript, I can access my website.

I've tried Validate Method, it's not working, I think it's because it's for dynamic routes, mine is a basic route.

How can I make Nuxt.js accept both https://example.com/ and https://example.com/index.html?

1 Answers

You have to define your routes in the underlying vue.js. How to configure see here:

 https://nuxtjs.org/guide/routing/

Watch that you make your project to "universal" instead "single page app" this has also implications.
The basic problem here is one framework on top of another on top of a programming language.

Related