0

I am creating a new Angular 15 application and for now its going to have only one page and that will be the landing page also. How can I restrict or redirect to the default landing page always when user attempts to launch with different path name?

For example:

  • If user attempts to load https://localhost:6150/hello i need to redirect to https://localhost:6150/landingpage.
  • If user attempts to load https://localhost:6150/ i need to redirect to https://localhost:6150/landingpage.

Redirection should happen only once in any of the above scenario.

halfer
  • 19,824
  • 17
  • 99
  • 186
Prabhakaran
  • 1,264
  • 2
  • 20
  • 47
  • 2
    You can define the default route to be `landingpage` and set up a [redirect](https://angular.io/guide/router#setting-up-redirects) for the wiidcard `**` route. Ideally the wildcard route should be some sort of "404" page, but you can also just redirect to a valid page instead. – Cuzy Jul 13 '23 at 08:53
  • @Cuzy - Let me test after adding the wildcard route to my landing page. – Prabhakaran Jul 13 '23 at 09:20

0 Answers0