
vue项目部署成功后刷新页面报404是什么原因,原因是路由mode改成了history导致的,下面web建站小编给大家介绍一下解决方法!
解决方法一:修改路由默认模式
const router = new VueRouter({
mode: "hash",
base: process.env.BASE_URL,
routes
});
//链接会出现#
解决方法二:nginx修改
location / {
root ...
index ...
try_files $uri $uri/ /index.html; ---解决页面刷新404问题
}
解决方法三:IIS修改
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="*">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
解决方法四:Apache修改
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
Nginx如何快速提高网站响应速度(Nginx Proxy Manager)
标签: Apache, iis配置, nginx, 网站404, 路由模式
上面是“vue项目部署成功后刷新页面报404(解决方法)”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_2982.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

帝国cms用灵动标签做的友情连接方法
博简智慧专利官网:一个AI专利查新检索与撰写平台
推荐一款Photoshop的优秀替代品——GIMP(免费开源)
AIGAZOU:简单的文本描述或照片上传,即可快速生成高质量原创图像
Tiny Aya模型使用入口,Cohere Labs正式发布的开源多语言模型