404 when reloading route o ng build --prod
See original GitHub issueInfo
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
-Mac OSX El Capitan
- Versions. Please run
ng --version
. If there’s nothing outputted, please run in a Terminal:node --version
and paste the result here:
angular-cli: 1.0.0-beta.11-webpack node: 6.3.0 os: darwin x64
- Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.
I’m geting a weird error, when I reload on any route with the cli (example “app/route”), everything works fine, but if I i “ng build --prod”, and then test it, if I reload on that particular route (‘app/route’), it gives me a 404 error instead of actually working, Am I doing something wrong?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Angular 2: 404 error occur when I refresh through the browser
To fix the 404 error, you need to update your server to serve the index.html file for each route path you defined. If...
Read more >Angular 6+ deploy to server/ solve 404 Not Found error on ...
This article will hep you to deploy angular 6+ application on apache server also to solve 404 not found error on page refresh....
Read more >The requested URL was not found on this server error in Angular
Angualr throws the requested URL was not found on this server (404 not found). It appears that angular routing not working on the...
Read more >How to setup 404 page in angular routing ? - GeeksforGeeks
To set up a 404 page in the angular routing, we have to first create a component to display whenever a 404 error...
Read more >Deployment - Angular
When you are ready to deploy, however, you must use the ng build command to build ... This is the simplest production-ready deployment...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah the basic idea is that the server loads routes based on files, but your whole angular app runs on index.html and it tells the browser which route to show, so with htaccess you pretty much route all server incoming traffic to index.html and it all runs smoothly 😃 This is the .htaccess I’m using:
Thank you @filipesilva, sorry for the confusion haha