Heim  >  Artikel  >  Backend-Entwicklung  >  如何设置注册和登入的URL为https,其他页面为http

如何设置注册和登入的URL为https,其他页面为http

WBOY
WBOYOriginal
2016-08-23 09:17:471776Durchsuche

公司开发了一个电子商城的项目。现在要求注册,登入,购物车,支付这些页面设置成HTTPS的传输,其他页面为HTTP传输。请教高手要如何配置?

回复内容:

公司开发了一个电子商城的项目。现在要求注册,登入,购物车,支付这些页面设置成HTTPS的传输,其他页面为HTTP传输。请教高手要如何配置?

单个域名确实无法解决这一问题, 因为你把站点exapmle.com部署为https时, 整个站点都是https传输的,

可以针对某一站点选择对应的传输方式

  • 一般页面 http://example.com

  • 登录注册 https://account.example.com

  • 购物车 https://cart.example.com

  • 支付 https://pay.example.com

部署两个域名啊: http://a.com和 https://ssl.a.com , 相关的地方跨域即可。

赞同 @leandre 和 @godruoyi 的回答,把需要用https协议的域名单独拿出来,请求相关url的时候走https协议。
但是这样有一个不方便的地方:通常一个https协议域名的页面,需要访问http协议的域名内容,这样的话就牵涉到跨域问题,跨域也有相关的解决方案,可以做,只是会麻烦些。
所以建议全站用https,虽然性能会有损耗,但优化做的好的话,https的性能完全可以接受。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn