๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ–ฅ๏ธํ”„๋ก ํŠธ์—”๋“œ/HTML | CSS | JAVASCRIPT

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ - http๋ฅผ https๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ

by Janger 2023. 5. 18.
728x90
๋ฐ˜์‘ํ˜•

 

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

if (document.location.protocol == 'http:') {
    document.location.href = document.location.href.replace('http:', 'https:');
}

 

 

์ถœ์ฒ˜: 

https://greendreamtrre.tistory.com/672

 

Javascript (์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ) HTTP ์ ‘์† ์‹œ HTTPS๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ

๋ณดํ†ต์€ ํ†ฐ์บฃ ์„œ๋ฒ„ ์„ค์ • ๋“ฑ์—์„œ ์ž๋™์œผ๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ ์‹œํ‚ค๋„๋ก ํ•˜์ง€๋งŒ ๊ฐ ํŽ˜์ด์ง€๋งˆ๋‹ค ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์ฒ˜๋ฆฌํ•˜๊ฑฐ๋‚˜ ์ถ”๊ฐ€ ๊ฒ€์ฆ์„ ์‹œ์ผœ์ผœ์ค„ ์ˆ˜ ์žˆ๋‹ค. if (window.location.protocol != "https:") { window.location.hre

greendreamtrre.tistory.com

 

728x90
๋ฐ˜์‘ํ˜•