why html base tag doesn't work

I tried to compile an Angular4 application today and deploy it to a path on the server. Since it is not the root path, I used the following statement:

ng build -prod -bh /rel

The statement in the natural Angular application index.html becomes:

<base href="/rel">

However, when I use http://localhost:8080/rel to open the webpage, it prompts Loading.... When I open the debugging, I find that the js path is not found, and the base tag does not take effect. The results of online self-study are as follows:

https://stackoverflow.com/questions/11521011/why-base-tag-does-not-work-for-relative-paths

Summary with the highest votes:

  1. Base is used with relative paths, do not use / before the path, this is not a relative path, this is an absolute path relative to Root;
  2. The href is followed by a backslash / to indicate that this is a directory

My problem above is done with a backslash after /rel.

Original address: http://blog.techcave.cn/2017/08/30/html%E7%9A%84base%E6%A0%87%E7%AD%BE%E4%B8%BA%E4%BB%80 %E4%B9%88%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326490594&siteId=291194637