【问题标题】:How do I display https instead of http in url bar after using SSL on my site在我的网站上使用 SSL 后,如何在 url 栏中显示 https 而不是 http
【发布时间】:2011-08-20 23:55:55
【问题描述】:

我的网站上有 SSL,但在顶部 URL 栏中仍然只显示 http:// 而不是 https://

我正在为我的网站使用带有 Django Python 堆栈的 Satchmo 系统。有人对此有所了解吗?

【问题讨论】:

  • 不确定这是否有帮助。如果它在 IIS 上运行,我会检查我的绑定。确保 SSL 绑定到端口 443,而不是 80,并确保在站点属性中选中“强制 SSL”。
  • 您需要将http://请求重定向到https://

标签: https satchmo


【解决方案1】:

无论使用什么网络服务器,您都需要告诉客户端访问您的安全 (https) 站点。

它们是不同的协议,httphttps。如果您希望客户端的浏览器使用您网站的https 版本,您将需要发出重定向。例如:

GET http://stackoverflow.com HTTP/1.1


HTTP/1.1 302 Found
Location: https://stackoverflow.com

您必须在您的网络服务器代码中找到触发重定向的机制。

【讨论】:

    【解决方案2】:

    想通了。在我的 httpd.conf 文件中我添加了这个:

    RewriteEngine on
    RewriteCond %{HTTP:X-Forwarded-SSL} !on
    RewriteCond %{REQUEST_URI} ^/about-us
    RewriteCond %{REQUEST_URI} ^/
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    

    “about-us”所在的位置是您要显示 https 的页面的 url

    【讨论】:

      猜你喜欢
      • 2017-06-06
      • 2018-07-01
      • 1970-01-01
      • 2015-01-13
      • 1970-01-01
      • 1970-01-01
      • 2014-01-26
      • 2015-04-21
      • 2013-09-14
      相关资源
      最近更新 更多