2014-09-08 4 views
0

루트 요청 "www.example.com"이 캐시에서 내용을로드하지만 모든 params 요청은 정상적으로 index.php"www.example.com/?action=1"을 통해 수행되도록 apache2를 다시 작성했습니다.루트 경로에 대한 RewriteRule

*** Vhost Confing file, NO.htaccess used *** 

     RewriteRule ^$ _cache/index.html [NC,L] #works on local only 
     # RewriteRule ^/$ _cache/index.html [NC,L] # 
     # RewriteRule ^index.php$ _cache/index.html [NC,L] #breaks normal requests 

     RewriteCond %{REQUEST_FILENAME} -s [OR] 
     RewriteCond %{REQUEST_FILENAME} -l [OR] 
     RewriteCond %{REQUEST_FILENAME} -d 
     RewriteRule ^.*$ - [NC,L] 
     RewriteRule ^.*$ /index.php [NC,L] 

문제는 내 컴퓨터에 좋은 일입니다 ..하지만 작동하지 않습니다 (이 좀 더 복잡한 실제 경우와 같이 캐싱 방식에 대해서는 언급하지 마십시오) 섬기는 사람. 봇 환경은 유사하다 :
지역 - 우분투 13.04
서버와 방랑 상자 - 그들은 단지이 프로젝트를 실행 우분투 14.04 구성 표준과 유사하다.

변경 사항이나 특정 설정이 잘못되었지만 알아낼 수없는 경우가 있습니다.

답변

1

쿼리 문자열은 다시 쓰는 요청 URI의 일부가 아닙니다. 다음 일반 규칙을

RewriteCond %{QUERY_STRING} ^$ 
RewriteRule ^$ _cache/index.html [L] 

: 그리고 당신이 재 작성은 빈 쿼리 문자열에서 발생 확인하려면 그래서, 당신은 조건를 추가해야합니다. 루프가 일어나고 있지만 마지막 규칙의 END가를 해결

# RewriteRule ^$ _cache/%{HTTP_HOST}.html [NC,END] 
    RewriteRule ^(|/|index.php)$ _cache/%{HTTP_HOST}.html [NC,L] 

    RewriteCond %{REQUEST_FILENAME} -s [OR] 
    RewriteCond %{REQUEST_FILENAME} -l [OR] 
    RewriteCond %{REQUEST_FILENAME} -d 
    RewriteRule ^.*$ - [NC,L] 
    RewriteRule ^.*$ /index.php [NC,END] 

확실하지 무엇을 :

0

나는 이런 식으로 고정 끝났다. 더 나은 구조 또는 설명 된 솔루션을 수락하게되어 기쁩니다.

관련 문제