도메인 체크하여 페이지 넘기는 소간단하게 하고 십습니다.

도메인 체크하여 페이지 넘기는 소간단하게 하고 십습니다.

QA

도메인 체크하여 페이지 넘기는 소간단하게 하고 십습니다.

본문

도메인 체크하여 페이지 넘기는 소간단하게 하고 십습니다. 

 

도메인을 체크하여 "domain/index.html"페이지로 넘길려고 하는데 아래소스로 하면은 넘 복잡한거 같아서 질문올립니다.

더 간단한 방법있스시면 알려세요 감사합니다.

 

 

<?php

switch ($_SERVER["HTTP_HOST"])

{

case "aaa.com":

header("location:domain/index.html");

break;

case "www.aaa.com":

header("location:domain/index.html");

break;

case "bbb.com":

header("location:domain/index.html");

break;

case "www.bbb.com":

header("location:domain/index.html");

break;

case "ccc.com":

header("location:domain/index.html");

break;

case "www.ccc.com":

header("location:domain/index.html");

break;

case "ddd.com":

header("location:domain/index.html");

break;

case "www.ddd.com":

header("location:domain/index.html");

break;

case "eee.com":

header("location:domain/index.html");

break;

case "www.eee.com":

header("location:domain/index.html");

break;

case "fff.com":

header("location:domain/index.html");

break;

case "www.fff.com":

header("location:domain/index.html");

break;

}?> 

이 질문에 댓글 쓰기 :

답변 1

아래 처럼 작성하시면 소스가 겁나게 짧아 지겠네요 ㅎㅎㅎ

 

$domain_array = array("aaa.com"=>"//www.naver.com","www.aaa.com"=>"//daum.net","bbb.com"=>"//sir.co.kr");
$zzz = $domain_array["{$_SERVER['HTTP_HOST']}"];
if (array_key_exists($_SERVER["HTTP_HOST"], $domain_array)) {
  header("location:$zzz");

답변을 작성하시기 전에 로그인 해주세요.
전체 125,873 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT