# Path problem after building an Ionic web application

**URL:** <https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414>\
**Category:** ionic-v3\
**Created:** [July 11, 2019, 10:47am UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414 "2019-07-11T10:47:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![trohde](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/trohde/32/126986_2.png) [@trohde](https://forum.ionicframework.com/u/trohde)\
**Post date:** [July 11, 2019, 10:47am UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/1 "2019-07-11T10:47:24Z")

</div>

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.

```auto
ionic start my-app sidemenu

```

Everything is okay when I run it in the browser.

```auto
ionic serve

```

With no changes I build it for production.

```auto
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 [https://github.com/ionic-team/ionic-cli/issues/3600](https://github.com/ionic-team/ionic-cli/issues/3600) I found that I have to set the base-href (this seems to be undocumented on ionic build --help).

```auto
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

---

<div class="post-metadata">

**Author:** ![danieldugger](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@danieldugger](https://forum.ionicframework.com/u/danieldugger)\
**Post date:** [July 11, 2019, 11:43am UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/2 "2019-07-11T11:43:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Alexis182](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alexis182/32/79200_2.png) [@Alexis182](https://forum.ionicframework.com/u/Alexis182)\
**Post date:** [June 7, 2020, 2:22pm UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/3 "2020-06-07T14:22:18Z")

</div>

Hi, have you solved the problem? (same for ionic 4 and 5)

---

<div class="post-metadata">

**Author:** ![trohde](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/trohde/32/126986_2.png) [@trohde](https://forum.ionicframework.com/u/trohde)\
**Post date:** [June 22, 2020, 9:22pm UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/4 "2020-06-22T21:22:01Z")

</div>

As far as I can remember, I have not really been able to solve the problem. I just copied a folder with all the svg files in an svg folder below the document root folder. It worked but in my eyes that’s not an appropriate solution.

---

<div class="post-metadata">

**Author:** ![Alexis182](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alexis182/32/79200_2.png) [@Alexis182](https://forum.ionicframework.com/u/Alexis182)\
**Post date:** [June 24, 2020, 3:20am UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/5 "2020-06-24T03:20:53Z")

</div>

Thanks…

This is some command that could be useful for someone 🤣  
`ionic build --prod -- --base-href /mobile --deploy-url /statics/app/`

---

<div class="post-metadata">

**Author:** ![rdemeratribalyte](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rdemeratribalyte/32/134448_2.png) [@rdemeratribalyte](https://forum.ionicframework.com/u/rdemeratribalyte)\
**Post date:** [October 15, 2020, 11:57pm UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/6 "2020-10-15T23:57:13Z")

</div>

I still have the same issue, i tried different things but it still does not work

ionic cordova build browser --prod --release – --base-href=/mobile

There is any solution?

Thanks!

---

<div class="post-metadata">

**Author:** ![rbarriuso](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rbarriuso/32/9038_2.png) [@rbarriuso](https://forum.ionicframework.com/u/rbarriuso)\
**Post date:** [October 22, 2020, 10:06am UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/7 "2020-10-22T10:06:38Z")

</div>

I think there’s a misunderstanding: the OP referred to Ionic 4, though the question has been tagged as “ionic-v3”

Ionic 3 uses `ionic-app-scripts`, which in turn uses `webpack` (instead of the Angular CLI) to generate the build, so the `--base-href` and `--deploy-url` flags from the Angular CLI won’t work on Ionic 3 apps.

---

<div class="post-metadata">

**Author:** ![GraineDeZele](https://avatars.discourse-cdn.com/v4/letter/g/87869e/32.png) [@GraineDeZele](https://forum.ionicframework.com/u/GraineDeZele)\
**Post date:** [November 11, 2020, 2:34pm UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/9 "2020-11-11T14:34:16Z")

</div>

> [@Alexis182](#):
>
> ionic build --prod – --base-href

I fixed the problem by modifying the base tag in the index.html file

`<base href="/myFolder/"/>`

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [November 12, 2020, 10:59pm UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/10 "2020-11-12T22:59:42Z")

</div>

> [@GraineDeZele](#):
>
> I fixed the problem by modifying the base tag in the index.html file

Not a great idea, because it won’t stick. Generally I think this entire topic is best handled by the deployment configuration, but if you absolutely insist on setting `baseHref`, do it in `angular.json`.

---

<div class="post-metadata">

**Author:** ![flyff-ionic](https://avatars.discourse-cdn.com/v4/letter/f/e480ec/32.png) [@flyff-ionic](https://forum.ionicframework.com/u/flyff-ionic)\
**Post date:** [December 29, 2023, 6:17am UTC](https://forum.ionicframework.com/t/path-problem-after-building-an-ionic-web-application/168414/11 "2023-12-29T06:17:10Z")

</div>

How should --base-href be specified in ionic 3
