Using vue-router in laravel, how to use html5 history
给我你的怀抱
给我你的怀抱 2017-05-16 16:46:44
0
2
679

How to use html5 history when using vue-router in laravel?
If new VueRouter({mode:'history',...}); is used, there will be no 127.0.0.1/#/ in the URL article, such # appears, and the route is not found. .
Waiting online. . . .

给我你的怀抱
给我你的怀抱

reply all (2)
PHPzhong

Transfer HttpException to your View in the exception handling Handler for processing! The remaining requests can only be made in API mode

Testing laravel 5.4

Only routes are defined in web routing.

    左手右手慢动作

    vue-routerEnablinghistorymode requires the support of the backend server.

    If the server isApache, the configuration is as follows:

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

    If the server isNginx, the configuration is as follows:

    location / { try_files $uri $uri/ /index.html; }

    See official website documentation for details.


    If the front-end is responsible for routing and the back-end only provides interfaces.
    Routes for interfaces are best defined inroutes/api.php.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!