Angular build for subfolder

21 Views Asked by At

I've an Angular 17 app that runs well on my domain. I now wanted to run a second build within a subfolder of my webserver like mydomain.com/pwa1

Since the default base-href is <base href="/"> I run a build with ng build --base-href='./pwa1' (also tried 'pwa1' '/pwa1' and './pwa1/').

Then I copied the results into the subfolder pwa1.

But now, if I call mydomain.com/pwa1 the url immediately changes to /pwa1/pwa1 - but the running app (webpage) itself look good and seems to work. Nevertheless, the pwa stuff fails, since it obviosly cannot find any files within 'pwa1/pwa1' - this folder doesn't exist.

Why is this happen? And isn't this the best practice to create a second build for a subfolder?

0

There are 0 best solutions below