2016-03-20 3 views
0

私は以下のIIS書き換えルールをウェブサイトのindex.phpページに使用しています。IIS書き換えルール - ブラウザでウェブサイトを開いたときにウェブサイト名から 'index'テキストを省略する方法

<rule name="INDEX"> 
<match url="^(.*)index$" /> 
<action type="Rewrite" url="index.php" appendQueryString="true" /> 
<conditions logicalGrouping="MatchAll"> 
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
<add input="{REQUEST_URI}" pattern="^/(user/inc|user/img)" ignoreCase="false" negate="true" /> 
</conditions> 
</rule> 

私はwww.sitename.comにアクセスすると、それはwww.sitename.com/indexのようなウェブサイトの最後にインデックスを追加します。

私がwww.websitename.comまたはwww.websitename.com/indexを書くと、www.sitename.comが表示されます。どうすればいいのか教えてください。

答えて

0

最後に、問題の解決方法を見つけました。

ルールを記述する前に、web.configファイルに次のコードを追加してください。ウェブサイトのパスに従ってindex.phpページのパスも変更してください。

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 

     <defaultDocument enabled="true"> 
      <files> 
       <remove value="user/index.php" /> 
       <add value="user/index.php" /> 
      </files> 
     </defaultDocument> 

     <rewrite> 
      <rules> 
       <rule name="INDEX"> 
        <match url="^(.*)index$" /> 
        <action type="Rewrite" url="user/index.php" appendQueryString="true" /> 
        <conditions logicalGrouping="MatchAll"> 
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
        <add input="{REQUEST_URI}" pattern="^/(user/inc|user/img)" ignoreCase="false" negate="true" /> 
        </conditions> 
       </rule> 
      </rules> 
     </rewrite> 

    </system.webServer> 
</configuration> 
関連する問題