2

Zend プロジェクトを Apache から IIS 7 に移動し、URL 書き換えをセットアップしました。ホームページは問題なく表示されますが、CSS と JavaScript が読み込まれません。

ここに私の書き換えスクリプトがあります

<?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>

元の 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]

助言がありますか?

4

1 に答える 1

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>
于 2013-03-16T18:45:28.330 に答える