2014-11-14 5 views
0

vhost의 디렉토리 루트 인 index.html이 있습니다. 병렬로 symfony 응용 프로그램이 있습니다.htaccess : 특정 파일로 리디렉션/모든 심포니 리디렉션을 유지합니다.

example.com 또는 example.com/ ist가 호출 될 때 index.html을 루트로 사용하고 싶습니다.

<iframe src="app.php" allowfullscreen></iframe> 

하지만이 문서의 루트로 index.html 세트를 가질 경우에도, 그것은 여전히 ​​app.php를 호출합니다 :

이 인덱스 파일은 iframe을 통해 심포니 응용 프로그램이 포함되어 있습니다. 나는 그것을 작동 시키려고 노력했지만, 내가 무엇을 놓치고 있는지 전혀 모른다.

이처럼 내 htaccess로 보이는 것입니다 :

DirectoryIndex index.html 

<IfModule mod_rewrite.c> 
    RewriteEngine On 

    # Rewrite path "/" to index.html 
    RewriteRule ^[/]?$ /index.html [L] 

    RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
    RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] 

    # If the requested filename exists, simply serve it. 
    # We only want to let Apache serve files and not directories. 
    RewriteCond %{REQUEST_FILENAME} -f 
    RewriteRule .? - [L] 

    # Rewrite all other queries to the front controller. 
    RewriteRule .? %{ENV:BASE}/app.php [L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    <IfModule mod_alias.c> 
     # When mod_rewrite is not available, we instruct a temporary redirect of 
     # the start page to the front controller explicitly so that the website 
     # and the generated links can still be used. 
     RedirectMatch 302 ^/$ /app.php/ 
     # RedirectTemp cannot be used instead 
    </IfModule> 
</IfModule> 

첫 번째 RewriteRule의 내 자신이지만, 그것은 작동하지 않습니다. index.html을 호출하지만 app.php를 index.html로 리디렉션하여 무한 재귀를 만듭니다.

답변

1

첫 번째 RewriteEngine On 바로 뒤에 다음 줄을 배치해야합니다 :이 라인

RewriteCond %{HTTP_HOST} ^example\.com [NC] 
RewriteRule ^$ index.html [L] 

, example.com이 요구되고 아무 것도 지정되지 않은 경우에만,이 인덱스에 메인 페이지를 리디렉션합니다. html

[편집]

코드는 괜찮습니다. RewriteCond %{ENV:REDIRECT_STATUS} ^$ 행을 RewriteCond %{ENV:REDIRECT_STATUS} 200으로 변경 하시겠습니까?

(참조 Apache mod_rewrite REDIRECT_STATUS condition causing directory listing)

+0

이것은 여전히 ​​무한 재귀를 만듭니다. –

+0

내 의견으로는, 내 코드는 재귀를 생성하지 않습니다. 제발, 내 업데이트 된 답변을 확인하십시오. – DaveG

+0

초기 재귀를 생성하지 않지만 /app.php 경로도 index.html로 리디렉션됩니다. 즉, iframe에 iframe이있는 기본 페이지가 포함되어 있다는 것을 의미합니다. 그 라인을 변경 했으므로 이제 크롬 브라우저에서 알려줍니다. 너무 많은 재귀가있다. –