Path problem after building an Ionic web application

Hi all,

I’m new to Ionic development and have just finished an application which I want to build and deploy as a normal web application. When I try to build it I struggle with a path problem. The easiest way to see my problem is when you create a new project.

ionic start my-app sidemenu

Everything is okay when I run it in the browser.

ionic serve

With no changes I build it for production.

ionic build --prod

When I copy the content of the www folder into a subfolder on my webserver (e.g. mobile) it fails to start because it tries to find the css and js files in the root of the webserver.

On I found that I have to set the base-href (this seems to be undocumented on ionic build --help).

ionic build --prod -- --base-href /mobile/

This works better and the application is running but it still tries to find the assets in the assets folder below the root folder (/htdocs/assets/ instead /htdocs/mobile/assets/. In the example app it’s only the file shapes.svg but in my app I have some more images and the translation files there.

Is there a way to set something like “–relative-paths” when building the application? Or is there another way?

Some additional information:
Ionic CLI : 5.2.1
Ionic Framework : @ionic/angular 4.6.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

I ran into the same situation using IIS. I followed the instructions within the deployment section of Angular’s documentation and fixed the problem. The issues is related to URL redirects.