How to remove hashbang from url?

DokiCRO picture DokiCRO · Jan 6, 2016 · Viewed 137.7k times · Source

How to remove hashbang #! from url?

I found option to disable hashbang in vue router documentation ( http://vuejs.github.io/vue-router/en/options.html ) but this option removes #! and just put #

Is there any way to have clean url?

Example:

NOT: #!/home

BUT: /home

Answer

Bill Criswell picture Bill Criswell · Jan 6, 2016

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