기존 도메인의 세부 주소로 들어온 경우, 새 도메인으로 접속케 하려면? 채택완료
예를 들어,
기존 주소: http://sir.co.kr/qa/write.php?sst=wr_num&s_tag=">http://sir.co.kr/qa/write.php?sst=wr_num&s_tag=그누보드4
※ 더 이상 sir.co.kr은 사용 안 함. 다만 포워딩시켜서 sir.co.kr로 접속 시, sir.com으로 연결해 사용 중.
바뀐 주소: http://sir.com/qa/write.php?sst=wr_num&s_tag=">http://sir.com/qa/write.php?sst=wr_num&s_tag=그누보드4
이 경우, http://sir.co.kr/qa/write.php?sst=wr_num&s_tag=">http://sir.co.kr/qa/write.php?sst=wr_num&s_tag=그누보드4 으로 접속해 들어올 경우,
http://sir.com">http://sir.com 대문이나 http://sir.com/qa/write.php?sst=wr_num&s_tag=">http://sir.com/qa/write.php?sst=wr_num&s_tag=그누보드4 페이지로 보내는 방법 있을까요?
답변 3개
루트폴더에 .htaccess 파일(파일명 앞쪽에 . 이 붙어야 됩니다) 생성한 다음 아래처럼 해보세요.
RewriteEngine on RewriteCond %{HTTP_HOST} ^(sir\.co\.kr)(:80)? [NC] RewriteRule ^(.*) http://sir.com/">http://sir.com/$1 [R=301,L]
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
</p><p>if($_SERVER['SERVER_NAME'] == "sir.co.kr") </p><p>{</p><p> header('Location:<a href="<a href="http://sir.com/" target="_blank" rel="noopener noreferrer">http://sir.com/</a>"><a href="http://sir.com/" target="_blank" rel="noopener noreferrer">http://sir.com/</a></a>'.$_SERVER['REQUEST_URI']);</p><p>}</p><p>
머 요런 식으로 돌리면 되지 않을까 싶은데요
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
가장 간단한 방법은 기존 도메인에서 포워딩 시키는 방법입니다.
도메인제공회사에서 제공해줍니다.
위의 경우에는 게시판이나 모든 페이지에서 적용시켜야 하니까 이 방법이 제일 간단할거 같구요
아니면
모든페이지에 공통으로 들어가는 head.php와 같은 파일 제일 위에 아래 자바 스크립으로 이동시켜도 됩니다..
location.replace("이동할 주소url");
답변에 대한 댓글 1개
$g4['cookie_domain'] = ".sir.com";
이 부분을 아래처럼 조건문을 이용해 설정 가능한가요? 예를 들어,
if (접속 주소가 sir.co.kr 로 시작하는 경우라면) {
$g4['cookie_domain'] = ".sir.co.kr";
} else if (접속 주소가 sir.com 으로 시작하는 경우라면) {
$g4['cookie_domain'] = ".sir.com";
}
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인