[Vuejs]-Nuxt Dynamic routes returns 404 after static generation

0👍

Im using Nuxt 2, by official doc, you need to add route for each parameter https://nuxtjs.org/docs/configuration-glossary/configuration-generate/#routes

For workaround solution, I may create a redirect page for dynamic page and url is

example.com/shop/redirect?page=2&sort=newest

In redirect page:

 mounted(){
        const p_page= this.$route.query.page
        const p_sort  = this.$route.query.sort
        this.$router.push(`/shop/sort/${p_sort}/page/${p_page}`)
    }

Leave a comment