2011-11-30 4 views
1

내가 하위 폴더 에 하위 도메인을 리디렉션하려고와 하위 폴더에 하위 도메인을 리디렉션 내가 루트에 배치 "테스트"(/ 테스트)htaccess로

subdomain1.mysite.com 
    subdomain2.mysite.com 
    subdomain3.mysite.com 

in test i have 3 folders `/test/subdomain1 , /test/subdomain2, /test/subdomain3` 

what i want is that: 
when i go to subdomain1.mysite.com it should be reading from: /test/subdomain1 
when i go to subdomain2.mysite.com it should be reading from: /test/subdomain2 
when i go to subdomain3.mysite.com it should be reading from: /test/subdomain3 

here is my htaccess used - placed in the folder "/test" and i think here is the problem!!: 

    Options -Indexes 
    <IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteBase/
    RewriteCond %{HTTP_HOST} ^subdomain1.mysite.com$ [NC] 
    RewriteRule ^(.*)$ subdomain1/$1 [L,QSA] 
    RewriteCond %{HTTP_HOST} ^subdomain2.mysite.com$ [NC] 
    RewriteRule ^(.*)$ subdomain2/$1 [L,QSA] 
    RewriteCond %{HTTP_HOST} ^subdomain2.mysite.com$ [NC] 
    RewriteRule ^(.*)$ subdomain3/$1 [L,QSA] 
    </IfModule> 

i am getting a "500 Internal Server Error" when accessing any subdomain... 

does RewriteBase works in subfolders ? if not placed the root ? 

any idea? 

thanks 
+0

RewriteCond %{HTTP_HOST} ^subdomain2.mysite.com$ [NC] RewriteRule ^(.*)$ subdomain3/$1 [L,QSA] 

subdomain2는'
'이 라인에'RewriteRule의 ^입니다 $ (*.) subdomain2/$ 1 [L, QSA]
'여기에 오류가 있거나 htaccess 파일에 오류가 있습니까? –

+0

아, 아니 매트 그 맞춤법 실수 나는 그것을 제거 !! –

답변

0

라는 이름의 폴더를 가리키는 3 하위 도메인이 난 당신이 URL에 . 탈출하지 않았기 때문에 500 오류가 믿는 :

RewriteCond %{HTTP_HOST} ^subdomain1.mysite.com$ [NC] 

이어야

RewriteCond %{HTTP_HOST} ^subdomain1\.mysite\.com$ [NC] 
+0

도움을 주신 Matt님께 감사드립니다 !! 나는 점들을 벗어나려고했지만 여전히 같은 오류가 발생했습니다 !! 내 도메인에 "-"가 포함되어 있습니다. –

+0

htaccess는 "test"폴더에 있습니다. 루트 레벨에 놓고 RewriteBase를 변경합니까? –

+0

htaccess를 루트로 이동하고 하이픈도 이스케이프 처리하십시오. –

0
개 오류가 있습니다

...

RewriteBase/
RewriteCond %{HTTP_HOST} ^subdomain1.mysite.com$ [NC] 
RewriteRule ^(.*)$ subdomain1/$1 [L,QSA] 
RewriteCond %{HTTP_HOST} ^subdomain2.mysite.com$ [NC] 
RewriteRule ^(.*)$ subdomain2/$1 [L,QSA] 
RewriteCond %{HTTP_HOST} ^subdomain2.mysite.com$ [NC] 
RewriteRule ^(.*)$ subdomain3/$1 [L,QSA] 

지난 2 개 라인 : 대신 subdomain3