【问题标题】:Redirecting to not-found page after reloading page (localize-router localization)重新加载页面后重定向到未找到的页面(本地化路由器本地化)
【发布时间】:2020-09-10 07:32:28
【问题描述】:

我使用 localize-router 模块进行本地化,在重新加载后路由本地化工作正常(http://localhost:4200/en)后重定向到未找到的页面这是我的应用程序路由

const appRoutes: Routes = [
  {path: '', canActivate: [AuthGuard], loadChildren: './com/wedoapps/views/main/main.module#MainModule',
    data: {
      metafrenzy: {
        title: '',
        tags: [
          {
            name: 'og:title',
            content: ''
          }, {
            name: 'og:description',
            content: ''
          }, {
            name: 'og:image',
            content: ''
          }
        ],
        links: [
          {
            rel: 'canonical',
            href: 'http://localhost/'
          }
        ]
      }
    }},
  {
    path: '**',
    redirectTo: 'not-found',
    pathMatch: 'full'
  }
];

【问题讨论】:

    标签: angular routes


    【解决方案1】:

    如果无法控制部署 ui 的服务器。

    RouterModule.forRoot(appRoutes, {useHash: true});

    如果可以控制部署 ui 的服务器

    在找不到url的情况下设置返回index.html。

    【讨论】:

    • 如果您无法控制后端并且无法更改后端配置。这是唯一的方法。
    • 仍然以其他方式添加。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-22
    • 1970-01-01
    • 2018-02-15
    • 2013-08-29
    • 2018-07-04
    相关资源
    最近更新 更多