1

I have loaded my application made with angular 6 and cli in a conventional hosting of name.com

For this I have followed the following steps:

  • ng build --prod
  • This generates me the dist folder
  • In the hosting in the root folder public_html I created a subfolder     called /test1 and there I put all the contents of the dist folder

Apparently everything works fine except for a couple of things: For example on the routes everything ok but when I copy and paste the url or update the page where I am at that moment I get the following error:

Not Found.

The requested URL /section/subsection was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

So when I run http://example.com/test1 it works fine but when I type http://example.com/test1/mysection it does not work anymore. But if I navigate within the site through the main menu it works fine.

That could be happening?

1 Answer 1

1

If you're deploying to a sub-folder, then you need to specify both --deploy-url and --base-href options in order for your assets to resolve properly and for routing to work:

ng build --prod  --deploy-url /test1/ --base-href /test1/
Sign up to request clarification or add additional context in comments.

Comments

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.