其中有一個問題就是怎麼移除網址中的index.php.
google上大多是apache的作法.
Stackoverflow的討論串提到的IIS的設定方法如下:
1.在CI所在的目錄下建立一個web.config檔
2.web.config的內容如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<rewrite>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
3.存檔後,網址就可以不用包含index.php了
原文來源:
http://stackoverflow.com/questions/12808063/remove-index-php-of-codeigniter-on-iis
沒有留言:
張貼留言