Angular - 页面刷新时的奇怪行为

问题描述 投票:0回答:1

网站打开正常,我能够顺利地浏览到不同的页面。然而,当我打开主页并按下刷新按钮时,网站就会中断,并返回以下信息。

{"seek":"21598","duration":"1:00:08"}

我不知道是什么原因。因为其他页面都不是这样的。

您可以通过点击查看网站 这里

我的app-routing如下。

const routes: Routes = [
   {path: '', redirectTo: '/home', pathMatch: 'full'},
   {path: 'home', component: HomeComponent},
   *** Other Routing
   {path: '**', redirectTo: '/home', pathMatch: 'full'}
];

我的.htaccess文件如下:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^(.*) /index.html [NC,L]
angular typescript routes angular-routing
1个回答
0
投票

你是否检查了你的Apache .htaccess 配置?

我不认为这是一个Angular路由问题。它似乎是服务器导航的问题,因为它正在返回301代码。你可以通过打开网络选项卡上的Dev工具并进行刷新来检查。它重定向到home,并在那里得到一些价值。

© www.soinside.com 2019 - 2024. All rights reserved.