开发者

Setting the cookie which works across HTTP and HTTPS, with www and without www

开发者 https://www.devze.com 2023-01-12 11:54 出处:网络
I have a website where I want to do transaction which has to be done over https, but the https works only without www (due to some issue while taking SSL certificate).

I have a website where I want to do transaction which has to be done over https, but the https works only without www (due to some issue while taking SSL certificate).

  1. http:/ /www.example.com
  2. https:/ /example. com

I want to set the cookies which are accessible in above of two.

Limitations: 1. https:/ /example. com can no开发者_开发问答t made https:/ /www.example. com, due to SSL certificate is not available for www.example. com) 2. http:/ /www.example. com can not be made http:/ /example. com, because Google has indexed lots of pages with www, so if you remove now, you loose the SEO

Regards, Prashant


for a cookie to be valid on all Subdomains, you use

.example.com (The dot at the beginning is important!)

I'm not sure about the SSL part though, you might get a warning if the non-secure cookie is being read on the secure domain.

Hope this helps, Freddy

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号