2

I made a simple Angular 5 cover to say that I'm still constructing this website. ng serve works fine locally, but now I wanted to host this on my schools website here and I get all these 404 resources not found and all I did was copy whats in the dist/ folder after running ng build --prod to the www/ folder on the webserver.

It's angular 5 with this cli version:

 "@angular/cli": "~1.7.1",
"@angular/compiler-cli": "^5.2.0",

I tried to push another one to github-pages and this has the same problem githubpages the repo is repo but it's almost an empty repo.

1 Answer 1

8

You need to add --base-href parameter when you build your application, like this:

ng build --prod --base-href /~320255eg/

Where /~320255eg/ represents the path to your application.

Sign up to request clarification or add additional context in comments.

8 Comments

Sounds plausible, I'll definitely try this! and I just bought a domain what url do I have to use there it's like this: www.blabla.be, will no --base-href work here?
When you app is hosted directly under the root folder of your domain, you won't need to set it, notice that by default, its value is set to / (root)
Your base href will be what you put after the first slash of your domain name, for instance in your github pages it will be /underconstruction
Yes! :) It's the same
So building your app with the --base-href some-path will update this <base-href="/"> tag.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.