How to remove hashbang from url?

后端 未结 11 633
生来不讨喜
生来不讨喜 2020-11-30 17:04

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 )

11条回答
  •  不知归路
    2020-11-30 17:44

    window.router = new VueRouter({
       hashbang: false,
       //abstract: true,
      history: true,
        mode: 'html5',
      linkActiveClass: 'active',
      transitionOnLoad: true,
      root: '/'
    });
    

    and server is properly configured In apache you should write the url rewrite

    
        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.html$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.html [L]
     
    

提交回复
热议问题