首页 > 解决方案 > 如何在线发布 Angular 项目?index.html 文件管理

问题描述

我有一个网站的角度项目。该网站使用 PHP 与在线数据库进行通信。

我上传了 PHP 文件并且与数据库的通信正常。现在我正在尝试上传角度前端,但我遇到了一些问题。

如果我尝试使用 example.com 搜索我的网站,我会收到此错误:“禁止访问,您无权访问此资源。”

这就是我所做的:

可能我的问题与 index.html 有关。网站的第一页应该是 login.component.html,我的 index.html 在我的编码过程中从未改变过。

这是我的 index.html:

<!doctype html>
<html lang="it">
<head>
  <meta charset="utf-8">
  <title>Angular</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body class="mat-typography">
  <app-root></app-root>
</body>
</html>

这是我的 app-routing.modules.ts:

import { NgModule } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { RouterModule, Routes } from '@angular/router';
import { AdminComponent } from './admin/admin.component';
import { HomeComponent } from './home/home.component';
import { LoginRegisterComponent } from './login-register/login-register.component';
import { NuovoPiattoComponent } from './admin/nuovo-piatto/nuovo-piatto.component';
import { VotiComponent } from './admin/voti/voti.component';
import { NuovoIngredienteComponent } from './admin/nuovo-piatto/nuovo-ingrediente/nuovo-ingrediente.component';
import { VotoComponent } from './home/voto/voto.component';


const routes: Routes = [
  {
    //first page
    path: '',
    component: LoginRegisterComponent
  },
  {
    path: 'home',
    component: HomeComponent
  },
  {
    path: 'admin',
    component: AdminComponent
  },
  {
    path: 'admin/nuovo-piatto',
    component: NuovoPiattoComponent
  },
  {
    path: 'admin/voti',
    component: VotiComponent
  },
  {
    path: 'admin/nuovo-piatto/nuovo-ingrediente',
    component: NuovoIngredienteComponent
  },
  {
    path: 'home/voto',
    component: VotoComponent
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

我什至没有触摸 app.component.html / .ts 文件。

你能帮助我吗?

标签: angulartypescriptpublishfilezilla

解决方案


推荐阅读