웹호스팅 환경에서 서브도메인 연결하기

HYEONG HWAN, MUN/ 2월 19, 2017/ 미분류/ 0 comments

https://blog.lael.be/post/5665

웹호스팅 환경에서 .htaccess 를 수정해서 서브도메인을 만드는 방법이다.
이 코드가 동작하려면 해당 도메인이 같은 웹루트로 연결되어 있어야 한다.

같은 웹루트로 연결된 페이지가 있다면, 서브도메인을 만들수 있고, 아예 다른 새로운 도메인도 연결할 수 있다.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} aaa.co.kr$ [NC]
RewriteCond %{REQUEST_URI} !^/aaa
RewriteRule ^(.*)$ /aaa/$1 [L]

RewriteCond %{HTTP_HOST} bbb.co.kr$ [NC]
RewriteCond %{REQUEST_URI} !^/bbb
RewriteRule ^(.*)$ /bbb/$1 [L]

RewriteCond %{HTTP_HOST} ccc.co.kr$ [NC]
RewriteCond %{REQUEST_URI} !^/ccc
RewriteRule ^(.*)$ /ccc/$1 [L]

</IfModule>

 

동일한 웹루트에서 여러 도메인을 처리하여 연결시키는 방법이다.

여러 사이트를 운영하고 싶은, 웹호스팅 사용자에게 유용한 정보이다.

 

Leave a Comment

작성하신 댓글은 관리자의 수동 승인 후 게시됩니다.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*