http:// 도메인에 www 를 무조건 넣거나 빼기 > 기술자료 | 해피정닷컴

http:// 도메인에 www 를 무조건 넣거나 빼기 > 기술자료

본문 바로가기

사이트 내 전체검색

http:// 도메인에 www 를 무조건 넣거나 빼기 > 기술자료

ClassicASP http:// 도메인에 www 를 무조건 넣거나 빼기

페이지 정보


본문

1. 도메인에 www 를 무조건 넣기
<%
' 도메인에 www 를 무조건 붙이기
'Request.ServerVariables("http_host")  ' http:// 또는 https:// 를 제외한 도메인주소
if Left(Request.ServerVariables("http_host"),4) <> "www." then
    %>
    <script>
        parent.location.href="//www.<%=request.ServerVariables("server_name")%><%=request.servervariables("http_url")%>";
    </script>
    <%
end if
%>


1-2. 여러개 도메인을 사용할때 ( 도메인 체크후 각각 다른 웹페이지로 넘김 )
  <%
    Dim header, header1, header2, sheader1, sheader2
    header = Request.ServerVariables("http_host")  ' http:// 또는 https:// 를 제외한 도메인주소
    header1 = Left(header,15)
    header2 = Left(header,19)
    
    sheader1 = "happyjung.co.kr"  // 15글자
    sheader2 = "www.happyjung.co.kr"  // 19글자
    
    'response.write header
    'response.End()
  %>  
  <script type="text/javascript">
    function on_load() {
      <% If header1 = sheader1 or header2 = sheader2 Then  %>
        parent.location.href="http://www.happyjung.co.kr/2.html";
      <% else  %>
        parent.location.href="https://www.happyjung.com/1.html";
      <% end if %>
    }
  </script>
</head>
<body onLoad="javascript:on_load();">


2. 도메인에 www 를 무조건 빼기
<%
' 도메인에 www 를 무조건 빼기
dim header_1
if Left(Request.ServerVariables("http_host"),4) = "www." then
    header_1 = split(request.ServerVariables("server_name"),"www.")
    %>
    <script>
        parent.location.href="//<%=header_1(1)%><%=request.servervariables("http_url")%>";
    </script>
    <%
end if
%>


참고자료
https://blog.naver.com/aussie98/23905505
http://rin2ne.tistory.com/169

댓글목록

등록된 댓글이 없습니다.


Total 198건 10 페이지
  • RSS
기술자료 목록
18
ClassicASP   40667  2007-08-17 22:13 ~ 2013-10-13 00:00  
17
ClassicASP   12966  2007-08-13 21:12 ~ 2014-01-13 00:00  
16
ClassicASP   11626  2007-07-20 19:41 ~ 2016-09-11 00:00  
15
ClassicASP   13659  2007-07-20 19:04 ~ 2016-08-30 00:00  
14
ClassicASP   19776  2007-07-20 18:45 ~ 2018-06-19 23:34  
13
ClassicASP   13160  2007-03-28 21:49 ~ 2013-12-28 00:00  
12
ClassicASP   36563  2007-03-21 23:15 ~ 2012-05-11 00:00  
11
ClassicASP   14500  2007-01-19 01:09 ~ 2014-09-09 00:00  
10
ClassicASP   18446  2007-01-19 00:00 ~ 2012-05-17 00:00  
9
ClassicASP   14139  2006-10-26 00:42 ~ 2016-08-30 00:00  
열람
ClassicASP   15782  2006-08-08 03:59 ~ 2020-01-16 18:42  
7
ClassicASP   26784  2006-06-26 10:13  
6
ClassicASP   38465  2006-06-19 21:33  
5
ClassicASP   13269  2006-06-19 19:12 ~ 2016-03-25 00:00  
4
ClassicASP   15424  2006-06-15 17:37 ~ 2021-10-15 01:09  
3
ClassicASP   27130  2006-06-14 12:33 ~ 2009-01-04 00:00  
2
ClassicASP   37009  2006-06-08 19:41  
1
ClassicASP   14912  2006-05-18 16:22 ~ 2013-05-03 00:00  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 1동 222호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 제2024-대전대덕-0405호 [사업자등록확인]  
Copyright 2001~2025 해피정닷컴. All Rights Reserved.