Refreshing my angular page gives me a 404 server error, it does the same if I manually navigate to directory in the search bar. I am hosting through an IIS Server.
This problem only occurs whenever I build my angular project with ng build --prod
and then upload it to my web server. Many people say you should use the hash method, but I don't want a hash to be displayed inside my url, and it's a very old method. Some people also say I should change my <base>
tag in my <head>
, but that hasn't worked.
Here's my <head>
tag from my index.html if it is helpful.
<head>
<!-- META DATA -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- APP -->
<title>SebastianElstadt</title>
<base href="/">
<link rel="icon" type="image/x-icon" href="assets/images/app-icon.png">
<!-- STYLES -->
<link rel="stylesheet" href="[fontawesome cdn]">
</head>
I also use a component which gets displayed if the entered URL doesn't match any of my defined paths. But it doesn't get displayed.
So to summarize, whenever I refresh my page or manually navigate in the search bar on my angular site, it displays a 404 Server Error page. And I don't want to use the hash method.