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
Quoting the docs.
You'd actually just want to set
mode
to'history'
.Make sure your server is configured to handle these links, though. https://router.vuejs.org/guide/essentials/history-mode.html
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
To be clear, these are all vue-router modes you can choose: "hash" | "history" | "abstract".
For vue.js 2 use the following:
For Vuejs 2.5 & vue-router 3.0 nothing above worked for me, however after playing around a little bit the following seems to work:
note that you will also need to add the catch-all path.
and server is properly configured In apache you should write the url rewrite