<% tabindex = 5000 NOWPAGE = Request.ServerVariables("path_info") If Request.ServerVariables("query_string") <> "" Then NOWPAGE = NOWPAGE & "?" & Request.ServerVariables("query_string") End if ' 현재 페이지 경로 확인 Dim currentPath, currentHost, slashCount, i currentPath = Request.ServerVariables("SCRIPT_NAME") currentHost = LCase(Request.ServerVariables("HTTP_HOST")) ' 경로의 슬래시(/) 개수 세기 slashCount = 0 For i = 1 To Len(currentPath) If Mid(currentPath, i, 1) = "/" Then slashCount = slashCount + 1 End If Next ' 슬래시가 1개면 최상위 폴더 (예: /page.asp, /default.asp) ' 슬래시가 2개 이상이면 하위 폴더 (예: /folder/page.asp) If slashCount > 1 Or currentPath = "/" Or currentPath = "/default.asp" Or currentPath = "/index.asp" Then ' 하위 폴더에서만 리다이렉션 ' sms.nninc.co.kr로 접속한 경우 If InStr(currentHost, "sms.nninc.co.kr") > 0 Then Response.Redirect "https://lms.nninc.co.kr" Response.End End If ' lms.nninc.co.kr로 접속한 경우 (포트 7444가 아닌 경우) 'If InStr(currentHost, "lms.nninc.co.kr") > 0 And InStr(currentHost, ":443") = 0 Then ' Response.Redirect "https://lms.nninc.co.kr" ' Response.End 'End If 'Call ForceHTTPS() End If ' HTTPS 체크 및 리디렉션 Function ForceHTTPS() Dim isHTTPS, serverPort, redirectURL ' HTTPS 프로토콜 체크 isHTTPS = (Request.ServerVariables("HTTPS") = "on") ' 서버 포트 체크 serverPort = Request.ServerVariables("SERVER_PORT") ' HTTPS가 아니거나 443 포트가 아닌 경우 If Not isHTTPS Or serverPort <> "443" Then ' 리디렉션 URL 구성 redirectURL = "https://" & Request.ServerVariables("SERVER_NAME") ' 기본 HTTPS 포트(443)가 아닌 경우 포트 번호 포함 ' 만약 443 포트로만 리디렉션하려면 이 부분 제거 ' If serverPort <> "443" And serverPort <> "80" Then ' redirectURL = redirectURL & ":443" ' End If ' 요청 경로 및 쿼리스트링 추가 redirectURL = redirectURL & Request.ServerVariables("URL") If Request.ServerVariables("QUERY_STRING") <> "" Then redirectURL = redirectURL & "?" & Request.ServerVariables("QUERY_STRING") End If ' 301 영구 리디렉션 Response.Status = "301 Moved Permanently" Response.AddHeader "Location", redirectURL Response.End End If End Function %>