2011-08-03 2 views
0

vhost 파일의 다음 지시문은 .htaccess 파일이 없을 때 올바르게 동작합니다. 그러나, 내가 그것을 소개 할 때 그것은 작동을 멈춘다. htaccess 재 작성이 not-matched 일 때 vhost 재 작성을 실행하려면 어떻게해야합니까? vhost.conf에서디렉토리 레벨 .htaccess vhost 다시 쓰기를 mod_rewrite가 중지합니다.

:

# Skip everything except html and json 
RewriteCond %{REQUEST_URI} \..+$ 
RewriteCond %{REQUEST_URI} !\.(html|json)$ 
RewriteRule .* - [L] 
# If html exists (is cached) 
RewriteRule ^$ index.html [QSA] 
RewriteRule ^([^.]+)$ $1.html [QSA] 
# Otherwise pass it on the index.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php [QSA,L] 

/test/.htaccess에서 : /test/hello.json에 대한

RewriteEngine on 
RewriteCond %{REQUEST_URI} old_directory/.*$ 
RewriteRule (.*)$ old_missing.phtml [PT] 

요청 ...
... .htaccess하지 않고는 : index.php로 라우팅하고 올바른 JSON을 반환합니다. .htaccess
은 ... : .htaccess로 ... 404 Not Found
반환 : .htaccess없이 ...
... /text/old_hello.phtml에 대한 404 Not Found

요청을 반환 또한 old_missing.phtml

의 내용을 반환 , 필자는 재 작성 로그를 꼬리로 채우고 .htaccess 규칙 (trip per-dir prefix, applying pattern, RewriteCond => not-matchedpass through)을 사용해야하는 것처럼 보였습니다. 멈 춥니 다.

"왜 이러는거야?"하고 물어 보는 사람들에게 두 가지 이유가 있습니다. 1) 돈을 받고 있습니다. 2) 사용자가 old_directory의 파일을 요청할 경우 메시지를 다시 전달해야 할 필요가 있으므로 새 Ajax .json 시스템으로 일부 Ajax .phtml 요청을 마이 그 레이션하고 있습니다. 변경. 감사.

답변

관련 문제