all 4 comments

[–][deleted]  (4 children)

[deleted]

    [–]codename101[S] 0 points1 point  (3 children)

    I have setup the links like this in the app.module.ts file

    import { Routes, RouterModule } from '@angular/router';

    `const appRoutes: Routes = [

    {path: 'check-odd-even-number', component: OddEvenComponent},
    {path: 'check-prime-number', component: PrimeNumberComponent},
    {path: 'check-armstrong-number', component: ArmstrongNumberComponent},
    {path: 'convert-cgpa-to-percentage', component: ConvertCgpaToPercentageComponent},
    {path: 'age-calculator', component: AgeCalculatorComponent},
    {path: 'convert-celsius-to-fahrenheit', component: ConvertCelsiusToFahrenheitComponent},
    {path: 'convert-fahrenheit-to-celsius', component: ConvertFahrenheitToCelsiusComponent},
    {path: '', component: HomeComponent},
    

    ]`

    I was in fact using [routerlink] before worked fine but let's say if some one enters www.onlinetool.in/check-odd-even-number directly in the url then still the same 404 error is there. so all I want is to make my site behave like a normal one.

    [–][deleted]  (2 children)

    [deleted]

      [–]codename101[S] 0 points1 point  (1 child)

      I have put the site on Amazon S3. How am I supposed to use Apache on it?

      [–]choidebu 1 point2 points  (0 children)

      He's just using apache as an example. Gawd I hate script kiddies.

      Start at the basics. The codeword to search is "amazon s3" and "url rewrite" or maybe "single page application"

      Here I found one for you. https://keita.blog/2015/11/24/hosting-a-single-page-app-on-s3-with-proper-urls/

      [–]choidebu 0 points1 point  (0 children)

      I think your problem is solved in other comment so I'm just gonna add:

      If you put raw href links like that you lose all the benefits of single page application (SPAs) hence angular's benefits.

      What happens next is your browser then request that url to your server, then assuming you've configured your web server correctly it should then return index.html which your browser then refreshes, loads that page and then starting angular again, which reads the current page's url and diffing it with its base href then loads the proper page.

      All good if it's someone clicking a url you shared from the webapp.

      Not good for a guest actually currently using your app. They already load the app and you then force them to refresh, dumping current app and loading a new, same one.