2013-03-16 4 views
2

Apache에서 IIS로 내 zend 프로젝트를 이동하고 URL 다시 쓰기를 설정했습니다. 홈 페이지가 잘 표시되지만 CSS와 자바 스크립트가로드되지 않습니다. 여기 Zend Framework 2 IIS URL 다시 작성

다음은 원래의 mod_rewrite 규칙

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

RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$ 
RewriteRule ^(.*) - [E=BASE:%1] 
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] 

어떤 제안이 내 재 작성 스크립트

<?xml version="1.0" encoding="UTF-8"?> 
    <configuration> 
    <system.webServer> 
     <defaultDocument> 
      <files> 
       <clear /> 
       <add value="index.php" /> 
      </files> 
     </defaultDocument> 
     <rewrite> 
      <rules> 
       <rule name="Imported Rule 1" stopProcessing="true"> 
        <match url="^.*$" /> 
        <conditions logicalGrouping="MatchAll"> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
        </conditions> 
        <action type="Rewrite" url="public/index.php" /> 
       </rule> 
       <rule name="Imported Rule 1-1" stopProcessing="true"> 
        <match url="\.(js|ico|txt|gif|jpg|png|css)$" ignoreCase="false" negate="true" /> 
        <action type="Rewrite" url="public/index.php" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 

입니까?

+0

아파치와 함께 사용했던 원래 규칙은 무엇입니까? 모든 요청은'public/index.php'만으로 보내집니다. – cheesemacfly

답변

5

Zend2 문서를 샅샅이 뒤져 본 결과 나는이 예제를 발견했습니다. 완벽하게 작동합니다! 나는 이것이 다른 누군가를 돕기를 바랍니다.

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
      <rule name="Imported Rule 1" stopProcessing="true"> 
       <match url="^.*$" /> 
       <conditions logicalGrouping="MatchAny"> 
        <add input="{REQUEST_FILENAME}" 
         matchType="IsFile" pattern="" 
         ignoreCase="false" /> 
        <add input="{REQUEST_FILENAME}" 
         matchType="IsDirectory" 
         pattern="" ignoreCase="false" /> 
       </conditions> 
       <action type="None" /> 
      </rule> 
      <rule name="Imported Rule 2" stopProcessing="true"> 
       <match url="^.*$" /> 
       <action type="Rewrite" url="index.php" /> 
      </rule> 
     </rules> 
    </rewrite> 
</system.webServer> 
</configuration> 
+1

나는 이것이 하나의 규칙에 결합 될 수 있다고 확신하지만이 방법으로 작동한다면 ... :) – cheesemacfly

+0

@aserwin 안녕하세요, IIS7에서 ZF2가 어떻게 작동하는지 알려주실 수 있습니까? 나는 가이드를 따라 URL 재 작성을 추가했지만 URL 재작 성이 완료되지 않은 것 같습니다. 어떤 충고? – QCar

+0

이것은 완전히 나를 위해 일했으며, .htaccess 파일을 다시 쓰기 규칙으로 변환 하려던 중 사망했습니다. 고마워요 @aserwin !!! – cardiac7