2011-07-22 6 views
1

iisのcakephpアプリケーションに.htaccessを置き換えるためにweb.configを使用する方法はありますか?we.configとcakephpアプリケーション

現在の.htaccessファイル

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^$ webroot/ [L] 
    RewriteRule (.*) webroot/$1 [L] 
</IfModule> 

UPDATE:IIS6にインポートを使用し

。それは私にこのweb.configを与えますが、サイトは機能しません。白い画面が表示されます。このhttp://book.cakephp.org/revisions/view/19937/URL-Rewrites-on-IIS7-Windows-hostsも試してみましたが、どちらもうまくいきませんでした。

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <rule name="Imported Rule 1" stopProcessing="true"> 
        <match url="^$" ignoreCase="false" /> 
        <action type="Rewrite" url="webroot/" /> 
       </rule> 
       <rule name="Imported Rule 2" stopProcessing="true"> 
        <match url="(.*)" ignoreCase="false" /> 
        <action type="Rewrite" url="webroot/{R:1}" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 

答えて

1

IISのMicrosoft URL書き換えモジュールをインストールします。それはあなたのApacheの書き換えルールをインポートさせます。あなたはここにモジュールを見つけることができます。

http://www.iis.net/download/urlrewrite

私は、IIS 7.0および7.5にCakePHPによるそれを使用し、それが御馳走に動作します。

EDIT

あなたは私のために、この設定を試すことができますか?

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <clear /> 
       <rule name="Imported Rule 1-1" stopProcessing="true"> 
        <match url="^(.*)$" ignoreCase="false" /> 
        <conditions logicalGrouping="MatchAll"> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
        </conditions> 
        <action type="Rewrite" url="/webroot/index.php?url={R:1}" appendQueryString="true" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 
+0

IIS 7にはURLの書き換えが組み込まれており、web.configファイルを使用できると聞いていただきありがとうございます。聞いたことがありますか? – madphp

+0

私はそれが標準としてインストールされているとは思わないが、インストールされていない場合は、Web Platform Installerを使用してダウンロードできます。インストールが完了したら、IISマネージャーのIISセクションにある「URL書き換え」アイコンをダブルクリックしてルールを追加できます。そこに入力するルールはweb.configファイルに保存されます。 –

+0

これはあなたを助けましたか?もう助けてもいいですか? –