반응형

 

etc/httpd/conf/httpd.conf


<VirtualHost *:80>
    ServerAdmin webmaster@test.com    
    ServerName  test.com
    ServerAlias www.test.com

    RewriteEngine on
    RewriteCond  %{HTTP_HOST} !^www\.test\.com$
    RewriteCond  %{HTTP_HOST} !^test\.com$
    RewriteCond  %{HTTP_HOST}      ^[^.]+\.test.com$
    RewriteRule  ^(.+)            %{HTTP_HOST}$1 [C]
    RewriteRule  ^([^.]+)\.test\.com(.*) /home/$1/www$2

    ErrorLog logs/test.com-error_log
    CustomLog logs/test.com-access_log common

    DocumentRoot /home/test/www/                
</VirtualHost>

위와 같을 경우

study.test.com 로 접속할 경우
/home/study/www디렉토리로 접속

jquery.test.com 로 접속할 경우
/home/jquery/www디렉토리로 접속

www.test.com,test.com
의 경우 test/www로 접속

반응형

'Linux' 카테고리의 다른 글

쉘스크립트에서 한글이 깨져 보일때 해결 방법  (0) 2014.02.08
scp  (0) 2013.06.28
파일 및 디렉토리 구조  (0) 2012.07.02
리눅스 명령어  (0) 2012.06.30
리눅스 사용자 생성  (0) 2012.05.12

+ Recent posts