2014-04-09 4 views
0

영어를 잘 못합니다. - 죄송합니다 ~iis6의 IIRF - 여러 도메인에서 하나의 IP로 특정 인덱스 페이지로 리디렉션

나는 하나의 서버를 호스팅하고 있습니다. (one ip)

이 웹 서버에는 3 개의 색인 페이지가 있습니다.

default.asp와 // s1_default.asp // S2-default.asp와

나는 세 가지 영역이있다. aaa.com & 두 개의 무료 하위 도메인. (s1.free.com, s2.free.com 예)

저는 iis6에 iirf를 설치했습니다.

내가 다시 작성하거나 aaa.com -------> default.asp와 s1.free.com ---> s1_default.asp s1.free.com ---> s1_default.asp

로 리디렉션 할

감사합니다 !!!

답변

1

나는이 튜토리얼이 당신을 도울 것이라고 생각하며, 대체 솔루션을위한 프로 및 콘트라를 제공한다. 링크 된 튜토리얼 http://www.seoconsultants.com/windows/isapi/subdomains/

인용구 :

설정 DNS 서버

는 DNS 서버에 다음 항목을 추가하고 그에 따라 도메인과 IP 주소를 변경합니다. 1.2.3.4

설정에서

* .example.com을 웹 서버

우리는 이미 주요 사이트에 만든 웹 사이트가 있다고 가정합니다 : www.example.com을. 따라서 하위 도메인의 모든 변형을 허용 할 수 있는지 다시 한번 확인하십시오.

IIS 관리 콘솔을 열고 웹 사이트를 선택하십시오. 마우스 오른쪽 버튼을 클릭하고 속성을 선택하십시오. 웹 사이트 탭을 클릭하십시오. 고급 버튼을 클릭하십시오. 호스트 헤더 이름이있는이 웹 사이트의 복수 ID 필드가 공백인지 확인하십시오. 이 항목은이 IP 주소로 오는 모든 요청을 차단합니다. IP 주소가이 웹 사이트에서만 사용되는지 확인하십시오. ISAPI_Rewrite 용 httpd.ini 설정

웹 루트의 httpd.ini에 다음 코드를 추가하십시오. 올바른 순서인지 확인하십시오. SUB1, SUB2 :

# Convert http://example.com to http://www.example.com/ 
RewriteCond Host: ^example.com 
RewriteRule (.*) http\://www\.example.com$1 [I,RP] 

# Assuming we have limited number of shared folders. 
# We will execute them accordingly regardless of the subdomain. 
# Example: http://sub1.example.com/img/logo.jpg -> /img/logo.jpg 
# Example: http://www.example.com/img/logo.jpg -> /img/logo.jpg 
RewriteRule (/css/.*) $1 [I,O,L] 
RewriteRule (/js/.*) $1 [I,O,L] 
RewriteRule (/img/.*) $1 [I,O,L] 

#Redirect all other subdirectories not matching 
#to the list above as subdomains 
#example: www.example.com\sub1 -> sub1.example.com 
RewriteCond Host: www\.example\.com 
RewriteRule /(\w*)/(.*) http\://$1\.example\.com$2 [I,RP] 

# If the web site starts with www then point the file to the root folder 
# If you specifically created a folder /www/ then you can comment out this section. 
RewriteCond Host: (?:www\.)example.com 
RewriteRule (.*) $1 [I,O,L] 

# Any web site starts other than www will be re-mapped to /<subdomain>/ 
# Example: http://sub1.example.com/default.asp -> /sub1/default.asp 
# Note: if the folder does not exists, then the user will get a 404 error automatically. 
RewriteCond Host: (.*)\.example.com 
RewriteRule (.*) /$1$2 [I,O,L] 

#Fix missing slash char on folders 
#This has to be at the end because if invalid dir exists, 
#we should show 404 first 
RewriteCond Host: (.*) 
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,RP] 

우리는 회사 웹 사이트와 두 개의 하위 도메인 생성을 가정하고 테스트 하위 도메인

.서버에

URI 오시는

http://www.example.com/
http://sub1.example.com/img/logo.jpg /img/logo.jpg 
http://sub2.example.com /sub2/ 
http://abc.example.com /abc/ -> 404 Not Found 

해결 방법 2 : 요약

두 번째 솔루션은 구현하기 쉽습니다 만, 사용자가 조심해야하는 웹 사이트의 인스턴스가 필요합니다 폴더를 만듭니다. 예를 들어 사용자는 ISAPI_Rewrite Rule of (/img/.*)과 충돌하므로 d : \ inetpub \ wwwroot \ example.com \ sub1 \ img \ 폴더를 만들 수 없습니다. 따라서 해당 폴더의 파일에 액세스 할 수 없습니다.

+0

감사 Querzel. – wideroot

관련 문제