Linux WEB

홈페이지 포워딩 하기

2008.05.21 19:41

jook 조회 수:30777

여러가지 방법을 사용하여 홈페이지를 포워딩 하는 방법

1. DNS를 이용하는 방법.

- DNS 의  zone 파일에서 아래와 같은 형식으로 CNAME 레코드를 이용한 포워딩 설정
hostway.co.kr 도메인의 zone 파일에 아래와 같은 형식으로 www의 CNAME을 설정하면, www.hostway.co.kr -> hostway.co.kr 로 포워딩 되게 된다.
===============================
                   A               211.239.xxx.xxx
                   MX           10 mail
mail            A                211.239.xxx.xxx
ftp              A                211.239.xxx.xxx
www         CNAME     hostway.co.kr.
===============================


2. index.html 파일에서 meta 태그를 이용하는 방법

- index 파일에서 meta 태그를 이용해서도 포워딩을 할 수 있다.
아래와 같은 형식으로 index 파일을 생성하여 포워딩할 URL을 입력 한다.
=============================================================
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.hostway.co.kr">
</head>
</html>
=============================================================


3. apache virtualhost 설정을 이용하는 방법

- DocumentRoot 디렉토리(홈페이지 디렉토리)가 동일한 경우는 ServerAlias 를 이용해서 홈페이지를 포워딩 한다.
아래와 같은 방식으로 ServerAlias 를 이용하면, http://hostway.co.kr 페이지와 http://www.hostway.co.kr 페이지는 동일하게  /home/hostway/public_html디렉토리에 있는 내용을 출력해 주게 된다.
hostway.co.kr 도메인이 아닌 다른 도메인의 경우도, ServerAlias를 이용해서 동일한 페이지가 보이도록 설정 가능하다.
==================================
<VirtualHost 211.239.xxx.xxx>
       ServerAdmin support@hostway.co.kr
       DocumentRoot /home/hostway/public_html
       ServerName hostway.co.kr
       ServerAlias www.hostway.co.kr
</VirtualHost>
==================================

- DocumentRoot 디렉토리가 다르거나, 다른 서버에 존재하는 홈페이지로 포워딩 할 경우는 Redirect 를 이용해서 포워딩 한다.
아래와 같이 ServerAlias와 Redirect를 설정해 놓은 경우, http://hostway.co.kr 페이지와 http://www.hostway.co.krhttp://hwk.co.kr 페이지로 포워딩 되게 된다.
===================================
<VirtualHost 211.239.xxx.xxx>
       ServerAdmin support@hostway.co.kr
       DocumentRoot /home/hostway/public_html
       ServerName hostway.co.kr
       ServerAlias www.hostway.co.kr
       Redirect / http://hwk.co.kr
</VirtualHost>
===================================