首页 > 其他分享 >解决SPA单页面应用(create-react-app,Vue-cli)路由跳转后404的问题。

解决SPA单页面应用(create-react-app,Vue-cli)路由跳转后404的问题。

时间:2022-11-19 10:12:05浏览次数:52  
标签:index Vue cli app error 404 html 跳转

在Nginx中配置try_files

server {
        listen        80;
        server_name  localhost;
        root   "****";
        location / {
	    try_files $uri $uri/ /index.html;
            index index.php index.html;
            error_page 404 /error/404.html;
            include ***;
            autoindex  off;
        }
	location /api/ {
            proxy_pass http://localhost:8055;
        }
}

标签:index,Vue,cli,app,error,404,html,跳转
From: https://www.cnblogs.com/wz0130/p/16905524.html

相关文章

  • vue3-cookies
    安装npminstallvue3-cookies--savemain.jsimport{createApp}from'vue'importAppfrom'./App.vue'importrouterfrom'./router'importstorefrom'./store......
  • Vue中使用Mock,devSever中before方法弃用>webpack新版本出现的vue.config.js配置问题:op
    话不多说直接上代码:1、mock相关配置(mock/index.js),这里仅使用 setupMiddlewares其余旧版级过渡版本方法见官网1//引入mock2constMock=require('mockjs');......
  • vue后台管理系统"编辑按钮"书写逻辑
    不废话上思路外部el-table-column是基础table模板,里面templateslot-scope的主要作用就是获取table一行的数据信息;其次要加一个对话框,在对话框里输入数值然后提交就可......
  • Vue.js -- 条件渲染
    条件渲染v-if的用法代码演示:<head><title>vue条件渲染</title><!--使用CDN引入Vue--><scriptsrc="https://unpkg.com/vue@next"></script></head><b......
  • 通过代码跳转路由
    <template><divid="app"><button@click="toHome">首页</button><buttonto="/about"@click="toAbout">关于</button><!--相当于占位符--><r......
  • Vue的基本使用
    引入vue.js<scriptsrc="vue.min.js"></script><scriptsrc="vue-router.min.js"></script>创建vue对象,绑定id<body><divid="app"></div> <scr......
  • 后端程序员必会的前端知识-03:Vue2
    三.Vue21.Vue基础1)环境准备安装脚手架npminstall-g@vue/cli-g参数表示全局安装,这样在任意目录都可以使用vue脚本创建项目创建项目vueui使用图形......
  • ESP32:Protocol version of client is unrecognized, expected Rev 1 (rosserial 0.5+
    问题通过​​Baize_ServoDriver_esp32​​这块开发板与ROS进行串口通信的过程中,发现出现了如下错误这个错误是在我运行了rosrunrosserial_pythonserial_node.py/dev/ttyU......
  • Windows安装fdfs_client_py_master.zip
    1.解压进入fdfs_client-py-master\fdfs_client目录下的storage_client.py注释fromfdfs_client.sendfileimport*importos,statimportstructimportsocketi......
  • Vue第三节
    目录4.通过axios实现数据请求4.2.1数据接口4.2.3ajax的使用4.2.4同源策略4.2.5ajax跨域(跨源)方案之CORS5.组件化开发5.1组件[component]5.1.1局部组件5.1.2默认组......