how to redirect encoded special characters url to proper address? in my project encoded url routing to web page. i created route something like this
{ path: 'welcome/:id', component: WelcomeComponent },
actually i am passing url like http://localhost/welcome%3Fid%3D45 but this is not accepting and it is accepting only http://localhost/welcome?id=45
{path: '**', component: 'NotFoundComponent'}
export class NotFoundComponent{
constructor(private router:Router,
private route: ActivatedRoute,
) {
let url = this.router.url;
url = url.replace(/%40/gi, '@')
.replace(/%3A/gi, ':')
.replace(/%24/gi, '$')
.replace(/%2C/gi, ',')
.replace(/%3B/gi, ';')
.replace(/%2B/gi, '+')
.replace(/%3D/gi, '=')
.replace(/%3F/gi, '?')
.replace(/%2F/gi, '/');
if(url !== this.router.url){
this.router.navigate([url]);
}
}