미채택 완료

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

2018-01-15 (월) 16:36:05 2,670

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개 / 댓글 3개

2018-01-15 (월) 17:16:11

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();

}

답변에 대한 댓글 1개

2018-01-15 (월) 17:20:29
여전힌 업체.com은 안먹히네용..

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

//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로 묶어보시는건...?

답변에 대한 댓글 2개

2018-01-15 (월) 16:56:15
답변 감사하지만
안먹히네용 ㅠㅠ
에구...실력이부족해서...죄송합니다.

답변을 작성하려면 로그인이 필요합니다.