2015-01-15 3 views
1

그래서 'm'하위 도메인을 '모바일'하위 디렉토리로 변경하기 위해 htaccess를 사용하고 있습니다.서브 디렉토리를 하위 디렉토리로 바꿀 때 .htaccess가 리디렉션 루프에 있습니다.

Htaccess에서 실행되도록이 코드를 만들었지 만 내부 루프를 반환합니다.

RewriteCond %{HTTP_HOST} ^m\. 
RewriteRule ^(.*) mobile/$1 [NC,L,QSA] 

'm'하위 도메인이있는 모든 파일 요청을 'mobile'디렉토리로 리디렉션하려고합니다.

[Thu Jan 15 19:01:29 2015] [error] [client xxx.xxx.xxx.xxx] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 

가 어떻게이 문제를 해결에 대한 갈 것이라고하는 error.log?

답변

2

당신이 필요합니다

RewriteCond %{HTTP_HOST} ^m\. [NC] 
RewriteRule ^((?!mobile/).*)$ mobile/$1 [NC,L] 

즉 경로 /mobile/에 대한 요청이 이미 /mobile/이없는 경우에만 가능합니다.

관련 문제