301리다이렉트 문의드립니다.

301리다이렉트 문의드립니다.

QA

301리다이렉트 문의드립니다.

본문

2개의 url을 하나의 url 주소로 뜨게 수정해야되는데

예를들면 업체com, 업체1.com 이 모두 업체.닷컴 url로 수정되게 하려합니다.

2개를 적용했더니 업체1.com은 먹히는데 업체.com은 안먹네요

두개모두 수정을 어케해야되나요


//php301 리다이렉트 방법
if( $_SERVER['HTTP_HOST'] == '업체.com' ){
  header('HTTP/1.1 301 Moved Permanently' );
  header( 'Location: http://업체.닷컴' );
  exit();
 
}

//php301 리다이렉트 방법
if( $_SERVER['HTTP_HOST'] == '업체1.com' ){
  header('HTTP/1.1 301 Moved Permanently' );
  header( 'Location: http://업체.닷컴' );
  exit();

}
 

이 질문에 댓글 쓰기 :

답변 2

같은함수가 두번나오니 나중에것만 먹인거같은데....

//php301 리다이렉트 방법
if( $_SERVER['HTTP_HOST'] == '업체.com' ){
  header('HTTP/1.1 301 Moved Permanently' );
  header( 'Location: http://업체.닷컴' );
  exit(); 
}else{

//php301 리다이렉트 방법
if( $_SERVER['HTTP_HOST'] == '업체1.com' ){
  header('HTTP/1.1 301 Moved Permanently' );
  header( 'Location: http://업체.닷컴' );
  exit();

}

}

이렇게 뭐아니면 뭐. 로 되게 else로 묶어보시는건...?

if( $_SERVER['HTTP_HOST'] == '업체.com' ){
  header('HTTP/1.1 301 Moved Permanently' );
  header( 'Location: http://업체.닷컴' );
  exit();
 
} else if( $_SERVER['HTTP_HOST'] == '업체1.com' ) {

  header('HTTP/1.1 301 Moved Permanently' );
  header( 'Location: http://업체.닷컴' );
  exit();

}

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

회원로그인

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