I am running an angular app with Azure static web app
. Is there a way to redirect subdomain to an internal path.
Let’s say : abc.mydomain.com. to mydomain.com/abc
I have already configured CNAME
in my DNS
.
I have tried configuring a .htaccess
file. ( and web.config
. even I know server is ubuntu).
None of them working.
Tried also configuring staticwebapp.config.json
but it seems to be working for internal route not subdomain.
Thanks in advance
2
Answers
Seems the only solution is doing it inside angular. In app.component.ts: ngOnInit(): void {
}
}
You can add the redirect route in your code directly and edit your
staticwebapp.config.json
like below:-app-routing.module.ts
staticwebapp.config.json
If you do not have route add the code directly to your
app.component.ts
:-