2017-07-28 41 views
1

我們有一個包含兩部分的Codeigniter項目。構建在Angular和後端(API)上的前端。所有的Angular-code都在/ app /中,CI的控制器和配置位於/ _api /文件夾中。 webapp的基礎位於「開始」控制器中。從web.config遷移到Angular/Codeigniter項目中的.htaccess

我們正試圖將Web服務器從IIS遷移到Ubuntu 16.04,並開始遇到問題,因爲我們之前沒有使用過.htaccess文件。現在,只要我們嘗試去,我們只會在CI的404頁上結束。

這裏的web.config中:

<configuration> 
    <system.web> 
    <customErrors mode="Off" /> 
    </system.web> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="Rewrite to index.php"> 
      <match url="index.php|robots.txt|images|test.php" /> 
      <action type="None" /> 
     </rule> 
     <rule name="Rewrite CI Index"> 
      <match url="api/*" /> 
      <conditions> 
      <add input="{REQUEST_FILENAME}" pattern="js" negate="true" /> 
      </conditions> 
      <action type="Rewrite" url="index.php/api/{R:0}" /> 
     </rule> 
     <rule name="Rewrite CI Index 2"> 
      <match url=".*" /> 
      <conditions> 
      <add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html|eot|woff|ttf|svg|php" negate="true" /> 
      </conditions> 
      <action type="Rewrite" url="index.php/start/" /> 
     </rule> 
     </rules> 
    </rewrite> 
    <caching enabled="false"></caching> 
    <staticContent> 
     <clientCache cacheControlMode="DisableCache" /> 
     <remove fileExtension=".woff" /> 
     <!-- In case IIS already has this mime type --> 
     <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> 
     <remove fileExtension=".woff2" /> 
     <!-- In case IIS already has this mime type --> 
     <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" /> 
    </staticContent> 
    </system.webServer> 
</configuration> 

回答

0

好吧!問題主要不是真正的.htaccess文件。最大的問題是從基於Windows的Web服務器轉向基於Linux的服務器。我們發現我們必須重新命名我們所有的CI控制器和模型,以大寫字母開頭。