为了添加一些上下文,我试图放置一个现有的Angular应用程序背后一些身份验证,使应用程序现在将访问地址说成功登录后http:// mysite / secure。
问题是如果我加载应用程序在http:// mysite / secure它工作正常(服务器显然会提供正确的页面),但单击任何链接将导致页面重新加载并路由到http:// mysite /#newpage而不是http:// mysite / secure /#newpage。
没有添加/安全/到所有的路由和链路元素是可能的?干杯,对不起,如果这不是写得好。
Relative links
Be sure to check all relative links,images,scripts etc. You must either specify the url base in the head of your main html file (
<base href="/my-base">
) or you must use absolute urls (starting with /) everywhere because relative urls will be resolved to absolute urls using the initial absolute url of the document,which is often different from the root of the application.Running Angular apps with the History API enabled from document root is strongly encouraged as it takes care of all relative link issues.