简体   繁体   English

AngularJs:使用 $locationProvider.html5Mode(true) 会触发来自 https 的意外 http 重定向

[英]AngularJs: Using $locationProvider.html5Mode(true) triggers unexpected http redirect from https

I added the line我添加了该行

$locationProvider.html5Mode(true);

in app.js of my webapp in order to revove the '#' symbol from the URL.在我的 webapp 的 app.js 中,以便从 URL 中删除“#”符号。 Once added this line (even only importing locationProvider) all requests in my site are redirected to http (port 80).添加此行(甚至仅导入 locationProvider)后,我站点中的所有请求都将重定向到 http(端口 80)。

I need to use https, can anyone help me?我需要使用https,有人可以帮助我吗?

Thanks, Laura谢谢,劳拉

Try and add to the head.尝试添加到头部。

<html>
  <head>
    <base href="/">
  </head>
</html>

You might also want to look into How to redirect HTTP to HTTPS Using .htaccess https://www.google.com/amp/s/www.freecodecamp.org/news/how-to-redirect-http-to-https-using-htaccess/amp/您可能还想了解如何使用 .htaccess 将 HTTP 重定向到 HTTPS https://www.google.com/amp/s/www.freecodecamp.org/news/how-to-redirect-http-to-https-使用-htaccess/amp/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM