在Angular/Codeigniter项目中从web.config迁移到.htaccess
我们有一个Codeigniter项目,它包含两个部分。构建在Angular上的前端和后端(API)。所有角度代码都位于/app/中,CI的控制器和配置位于/_api/文件夹中。webapp的基础是“开始”-控制器 我们正在尝试将web服务器从IIS迁移到Ubuntu 16.04,但由于之前没有使用过.htaccess文件,所以开始遇到问题。现在,无论我们去哪里,我们都只能在CI的404页面上结束 以下是web.config:在Angular/Codeigniter项目中从web.config迁移到.htaccess,.htaccess,codeigniter,web-config,.htaccess,Codeigniter,Web Config,我们有一个Codeigniter项目,它包含两个部分。构建在Angular上的前端和后端(API)。所有角度代码都位于/app/中,CI的控制器和配置位于/_api/文件夹中。webapp的基础是“开始”-控制器 我们正在尝试将web服务器从IIS迁移到Ubuntu 16.04,但由于之前没有使用过.htaccess文件,所以开始遇到问题。现在,无论我们去哪里,我们都只能在CI的404页面上结束 以下是web.config: <configuration> <system.
<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>
好的!问题主要不是.htaccess文件。最大的问题是从基于Windows的web服务器迁移到基于Linux的web服务器。我们发现我们必须重命名所有CI控制器和模型,以大写字母开头。好的!问题主要不是.htaccess文件。最大的问题是从基于Windows的web服务器迁移到基于Linux的web服务器。我们发现我们必须重命名所有CI控制器和模型,以大写字母开头