【问题标题】:angular hide base href from URLURL中的角度隐藏基本href
【发布时间】:2021-09-11 12:48:27
【问题描述】:

我在同一域下的 iis 中有一个 Angular 项目和一个 web api 主机。 我放在文件夹 /web 中的角度构建文件,而 api 发布文件在 /api 文件夹中。 当我构建角度时,我使用ng build --base-href "/web/" --prod.and 在 web.Config 文件中重写了它<action type="Rewrite" url="/web/" />。 当我浏览网站时,网址是http://localhost:8090/web/login。怎么去掉或者隐藏url中的web,让url变成http://localhost:8090/login

【问题讨论】:

  • SO 上已经有很多问题和答案。尝试使用搜索功能。与此同时,这会有所帮助吗? devblogs.microsoft.com/premier-developer/…
  • 如果你只是从你的配置中删除 --base-href 和 看起来它会起作用

标签: angular api asp.net-core asp.net-core-webapi


【解决方案1】:

要隐藏它,只需更改基本 href。

ng build --base-href "/" --prod

这将起作用并解决问题。

【讨论】:

    猜你喜欢
    • 2018-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-04
    • 2019-09-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多