웹호스팅 환경에서 .htaccess 를 수정해서 서브도메인을 만드는 방법이다.
이 코드가 동작하려면 해당 도메인이 같은 웹루트로 연결되어 있어야 한다.
같은 웹루트로 연결된 페이지가 있다면, 서브도메인을 만들수 있고, 아예 다른 새로운 도메인도 연결할 수 있다.
[code language="bash"]
<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>
[/code]
동일한 웹루트에서 여러 도메인을 처리하여 연결시키는 방법이다.
여러 사이트를 운영하고 싶은, 웹호스팅 사용자에게 유용한 정보이다.
Conversation
In the margins
0 notes
No comments yet. Be the first to leave a note.