Set up a sub directory with nuxt.js

Morning,

I am using nuxt.js and need to set up a subdirectory for the domain. The desired final url is https://annual-review.THEIRDOMAIN/2021/ and next year it will be https://annual-review.THEIRDOMAIN/2022/ etc. The annual-review part is already a subdomain set up through the DNS, which is working as expected.

I have set up a different router base for staging–cambridge-enterprise-web.netlify.app in my nuxt.config of ‘2021’. This works perfectly when generated locally and automatically redirects to localhost:3000/2021/ as the root url.

However, when I deploy to netlify it is erroring the entire site with multiple 404 errors, as you can see on the staging site https://staging--cambridge-enterprise-web.netlify.app/ and Cambridge Enterprise Annual Review 2021 | Cambridge Enterprise Annual Review 2021. I think I need to add my path 2021 to the deploy settings on netlify somewhere but it doesn’t fit into either the publish directory or the base directory. My base directory is /web/ as its nested inside my git repo, and so my publish directory is /web/dist/. Neither of these are the right place to add 2021 (and I have tried, it doesn’t work!).

Please can someone help me with this? Our client needs this live and I can’t help them currently!

Hi @andyatflocc

Visiting https://staging--cambridge-enterprise-web.netlify.app/ automatically redirects to https://staging--cambridge-enterprise-web.netlify.app/2021/ and works fine for me. I see no 404 errors.

Did you make changes or are you still experiencing this issue?