How to remove hashbang from url?
You'd actually just want to set mode
to 'history'
.
const router = new VueRouter({
mode: 'history'
})
Make sure your server is configured to handle these links, though. https://router.vuejs.org/guide/essentials/history-mode.html
For vue.js 2 use the following:
const router = new VueRouter({
mode: 'history'
})
Hash is a default vue-router mode setting, it is set because with hash, application doesn't need to connect server to serve the url. To change it you should configure your server and set the mode to HTML5 History API mode.
For server configuration this is the link to help you set up Apache, Nginx and Node.js servers:
https://router.vuejs.org/guide/essentials/history-mode.html
Then you should make sure, that vue router mode is set like following:
vue-router version 2.x
const router = new VueRouter({
mode: 'history',
routes: [...]
})
To be clear, these are all vue-router modes you can choose: "hash" | "history" | "abstract".