Reputation: 11780
I've deployed a VueJS
project to a domain like www.example.com
, however, I want to move it to a subfolder so that I can access it like www.example.com/v1
How can I set the base URL or root URL of a VueJS
project?
Note: It's not about the base URL for Vue-resource
Upvotes: 0
Views: 4725
Reputation: 73609
You can use option base
as /v1/
to move all routes to have base as /v1/
.
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/".
How about moving all your routes to nested route, with parent route being /v1
:
const router = new VueRouter({
routes: [
{ path: 'v1', component: BaseView,
children: [
{
// UserProfile will be rendered inside BaseView's <router-view>
// when /v1/profile is matched
path: 'profile',
component: UserProfile
},
{
// UserPosts will be rendered inside BaseView's <router-view>
// when /v1/posts is matched
path: 'posts',
component: UserPosts
}
]
}
]
})
Upvotes: 1