如何去掉#号,在微信jssdk中,#之后的会被剪切掉

1***@qq.com
- 发布:2019-12-11 19:38
- 更新:2021-06-02 21:05
- 阅读:6695
uniapp访问路径#能否去掉????
分类:uni-app

uniapp 的history 把#去掉了,但是当刷新页面的时候出现404
解决方案
需要服务端支持
如果 URL 匹配不到任何静态资源,则应该返回同一个 index.html 页面
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
location / {
try_files $uri $uri/ /index.html;
}
若小若
感谢 找了好多 你的方案就可以了
2021-10-13 14:56