Javascript ile HTTPS Yönlendirme

Merhaba arkadaşlar bu blog yazımda sadece https kullanmak isteyen siteler için basit bir kod sayesinde http olan sitenizi https'e yönlendirebileceksiniz


Merhaba arkadaşlar bu blog yazımda sizlere http hatası veren veya sadece https kullanmak isteyen siteler için basit bir kod sayesinde http olan sitenizi https'e yönlendirebileceksiniz. Bu yönlendirme tamamen http'yi https'e dönüştürmektedir. Eğer bağlantı türü https değilse yönlendirme yapılacaktır. Kod:

if(location.protocol != 'https:'){ location.href = 'https:' + window.location.href.substring(window.location.protocol.length);}

Bir sonraki yazımda görüşmek üzere iyi çalışmalar :)