# Serve of www outside of Ionic does not work

**URL:** <https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774>\
**Category:** Ionic Angular\
**Created:** [May 27, 2023, 5:36pm UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774 "2023-05-27T17:36:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dtlinker](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@dtlinker](https://forum.ionicframework.com/u/dtlinker)\
**Post date:** [May 27, 2023, 5:36pm UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/1 "2023-05-27T17:36:19Z")

</div>

I have an Ionic Angular app that I have recently updated.

It works fine with ionic serve or http-serve, but if I try test it with MAMP or move the www folder to to my remote server it does not work.

This used to work previously.

Looking at the console, it appears to have a problem finding a number of files.

I am using Ionic 6.20.1, Angular CLI 13.1.2 on MacOS Ventura 13.1.

Thanks for any tips.

David

---

<div class="post-metadata">

**Author:** ![JDMIonic](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@JDMIonic](https://forum.ionicframework.com/u/JDMIonic)\
**Post date:** [May 29, 2023, 1:04am UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/2 "2023-05-29T01:04:19Z")

</div>

I have the same issue. Found several old post about this:

- [Www/index.html get reverted back to a blank default version - #8 by Sujan12](https://forum.ionicframework.com/t/www-index-html-get-reverted-back-to-a-blank-default-version/109351/8)
- [ionic4 - why ionic www folder is showing blank content - Stack Overflow](https://stackoverflow.com/questions/56822833/why-ionic-www-folder-is-showing-blank-content)
- [Can't host build output in subfolder · Issue #3555 · ionic-team/ionic-cli · GitHub](https://github.com/ionic-team/ionic-cli/issues/3555)

None of these fixed the issue. Back then i was able to build the app, copy all files in the www folder and upload to my server and it worked. Now the index.html is blank.

But when i tried the steps here to upload to firebase hosting, it works:

- [Make Progressive Web Apps (PWA) in Angular - Ionic Tutorial](https://ionicframework.com/docs/angular/pwa#deploying)

But i don’t want to host on firebase, i want to host on my own server.

It seems theres a bug in the Ionic CLI build process. Would be great if someone in the Ionic Team can tell us whats going on.

---

<div class="post-metadata">

**Author:** ![Hills90210](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@Hills90210](https://forum.ionicframework.com/u/Hills90210)\
**Post date:** [May 30, 2023, 1:08pm UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/3 "2023-05-30T13:08:40Z")

</div>

I’m having the same issues.

---

<div class="post-metadata">

**Author:** ![Hills90210](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@Hills90210](https://forum.ionicframework.com/u/Hills90210)\
**Post date:** [June 5, 2023, 3:37pm UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/4 "2023-06-05T15:37:19Z")

</div>

Can anyone from the Ionic team chime in please?

---

<div class="post-metadata">

**Author:** ![sepehr](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sepehr/32/126847_2.png) [@sepehr](https://forum.ionicframework.com/u/sepehr)\
**Post date:** [June 7, 2023, 8:14am UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/5 "2023-06-07T08:14:45Z")

</div>

So changing the `base href` didn’t help?

---

<div class="post-metadata">

**Author:** ![JDMIonic](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@JDMIonic](https://forum.ionicframework.com/u/JDMIonic)\
**Post date:** [June 7, 2023, 12:25pm UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/6 "2023-06-07T12:25:39Z")

</div>

No, changing the base href does not help. IIRC you never had to change the base href.

---

<div class="post-metadata">

**Author:** ![sepehr](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sepehr/32/126847_2.png) [@sepehr](https://forum.ionicframework.com/u/sepehr)\
**Post date:** [June 7, 2023, 10:56pm UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/7 "2023-06-07T22:56:12Z")

</div>

> Now the index.html is blank.

Open the index.html file **inside your www** folder in a text editor and:

1. Add `hydrated` class to the `<html>` tag
2. Replace `<app-root></app-root>` with some text

```auto
<html class="hydrated">
...
<body>
	<h1>This text should be visible.</h1>
</body>

```

Save the file and reload the page in your browser. Now do you see the text?

---

<div class="post-metadata">

**Author:** ![dtlinker](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@dtlinker](https://forum.ionicframework.com/u/dtlinker)\
**Post date:** [June 11, 2023, 5:20am UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/8 "2023-06-11T05:20:27Z")

</div>

I don’t know the root cause, but I have found an error that I can correct manually.

In index.html there is a line:

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

```

With ionic serve, and with my test server, the code was in the root of the server directory, but when I uploaded it to the remote server it was in a subfolder and failed. when I changed “/” to “./” it worked.

An additional problem was that I just found that it was just randomly changed to:

````auto
 <base href="app.scss"/>```

which clearly also does not work. I do not know how that happened, but changing it back to "./" fixed the problem.
````

---

<div class="post-metadata">

**Author:** ![ciccilleju](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ciccilleju/32/135142_2.png) [@ciccilleju](https://forum.ionicframework.com/u/ciccilleju)\
**Post date:** [June 12, 2023, 8:36am UTC](https://forum.ionicframework.com/t/serve-of-www-outside-of-ionic-does-not-work/233774/9 "2023-06-12T08:36:58Z")

</div>

with angular only i usually deploy like this:

ng build --prod --base-href=“/my-app/”  
and then  
grunt --gruntfile grunt-war.js war

and i use the war file to deploy

gruntfile is made like this

module.exports = function ( grunt ) {  
grunt.loadNpmTasks( ‘grunt-war’ );

```
var taskConfig = {
    war: {
        target: {
            options: {
                war_verbose: true,
                war_dist_folder: 'build', // Folder path seperator added at runtime.
                war_name: 'my-app', // .war will be appended if omitted
                webxml_welcome: 'index.html',
                webxml_display_name: 'Grunt WAR'
            },
            files: [
                {
                    expand: true,
                    cwd: 'dist/my-app',
                    src: ['**'],
                    dest: ''
                }
            ]
        }
    }
};

grunt.initConfig( taskConfig );

```

};`
