2014-04-08 4 views
0

내 사이트 인 site.com에 여러 하위 도메인이 있습니다. 이러한 하위 도메인 중 하나는 go.site.com입니다. go.site.com의 모든 404 요청이 하위 도메인의 홈페이지 (go.site.com)로 리디렉션되도록해야합니다. 내 기본 도메인과 다른 하위 도메인에 영향을주지 않아야합니다.htaccess는 하위 도메인의 모든 404를 하위 도메인 홈페이지로 리디렉션합니다.

example 1: go.site.com/abcdefg/ returns a 404 and should redirect to go.site.com 
example 2: go.site.com/page/ returns a 200 and should NOT redirect anywhere 
example 3: site.com/abcdefg/ returns a 404 and should NOT redirect anywhere 
example 4: sub.site.com/abcdefg/ returns a 404 and should NOT redirect anywhere 

.htaccess로 어떻게 처리 할 수 ​​있습니까? 그건 그렇고, 그것은 워드 프레스 multisite.

답변

1

당신이 재 작성 규칙 가질 수 있습니다

RewriteEngine On 

RewriteCond %{HTTP_HOST} ^go\.site\.com$ [NC] 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^/[L,R] 
+0

감사하지만,이 추가하면 내 404의 리디렉션하지 않았다. 내가 시도 할 수있는 다른 어떤 생각? – user2930880

+0

이 규칙은 go.site.com URL에만 적용됩니다. – anubhava

+0

하지만 위의 예에서 go.site.com/abcdefg/를 방문하면 404 페이지가 표시됩니다. 그 요청이 go.site.com으로 리디렉션해야합니다. – user2930880

관련 문제