简体   繁体   中英

Deploy Nuxt app to subdirectory on domain

We have a nuxt application which is deployed to a subdirectory on our main domain, lets call the directory 'app'.

But all routes and references to assets refer to the main domain (domain.com/page-1 instead of domain.com/app/page-1). We have tried to solve it with setting 'base' in the router setting. But this results in de app being 1 level deeper (so domain.com/app/app and domain.com/app/app/page-1). In this case all the links and assets refs are ok. How can this be solved?

Referring to nuxt.js official documentation here: https://nuxtjs.org/api/configuration-router

You have to set the custom path in the router config property object in nuxt.config.js. It's actually the exact answert to question:

The base URL of the app. For example, if the entire single page application is served under /app/, then base should use the value '/app/'.

:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM