SetbaseURL is not working in the router

I used coldbox 7. I added the setbaseurl based on the appmapping and added the route in the router.cfc.

if( len(getSetting(‘AppMapping’) ) lte 1){
setBaseURL(“http://#cgi.HTTP_HOST#/index.cfm”);
}
else{
setBaseURL(“http://#cgi.HTTP_HOST#/#getSetting(‘AppMapping’)#/index.cfm”);
}

route(
pattern : “/login”,
target : “main.login”
);

When I try to hit http://localhost/login , It is working fine.

AppMapping as dharcf → When I try to hit http://localhost/dharcf/login , Facing issue like ’ The event: login is not a valid registered event.’

I hope, SetbaseURL is not working. Should I need to add anything?

Could you please help me to resolve this issue?

NOTE: There is no rewrite rule added.

Install our route-visualizer module so you can visualize what’s going on with routes. You can also install the cbDebugger so you can see what routes are being matched.

Thanks a lot for you reply. I’ve resolved my issues.