###项目部署时候和接口设置了不同的子域名, VUE跨域后,
###使用proxyTable 进行了跨域设置 然后地址就变成了近似一致,在调试工具中使用https://www.domain.com/apis 访问是https://gr.domain.com
proxyTable: {
'/apis': {
target: 'https://gr.domain.com', // 接口地址
changeOrigin: true,
pathRewrite: {
'^/apis': '' //需要rewrite重写的,
}
}
}
###https://gr.domain.com vue项目上线后子页面404 ,404的原因是开启了vue路由的 mode: 'history' 模式,所以需要在PHP中进行伪静态设置↓
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
###php apache 增加了.htaccess 文件 可是这个文件把 https://www.domain.com/apis 也给重写了,