【发布时间】:2019-03-12 09:29:15
【问题描述】:
我有一个 Angular 6 项目;在根目录的子目录中是带有 CodeIgniter (/api) 的服务器。
具有 404 的重定向配置到 web 的主页;我可以输入 api 的索引路径(/api/index.php),但任何深入 api 的路径都会将我重定向到网络的主页。
我想知道;如何告诉 Angular Routing 不要控制该路由 (/api) 或错误重定向的原因。
app.routes.ts
export const routes: Routes = [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', redirectTo: 'home',pathMatch: 'full'},
{ path: 'pages', redirectTo: 'pages', pathMatch: 'full' },
{ path: 'store', redirectTo: 'pagesstore', pathMatch: 'full' },
{ path: '**', redirectTo: 'home', pathMatch: 'full' },
];
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Credentials true
</IfModule>
【问题讨论】:
标签: angular codeigniter-3 .htaccess