Obtain an incorrect URL for sub-shop when using the router in helper class

Hello all,

I have a controller with some route scope like the one mentioned below,

  • @Route(„/example/redirect“, name=„my.route.name.label“, methods={„POST“})

and my sub-shop URL like this - https://sampledomain.com/subshop

When I have generated the URL for this controller using the route, I always get the wrong URL:

Coding in helper class:
$this->router->generate(‚my.route.name.label‘, [ ], UrlGeneratorInterface::ABSOLUTE_URL);

Excepted Output
https://sampledomain.com/subshop/example/redirect

Current Output
https://sampledomain.com/example/redirect

shopware version - 6.5.5.0. If any thing missed in the URL generation please any one guide me

maybe you should start with

bin/console debug:router

then you might see if the route is registered correctly.
Also you need to clear the cache so the annotations gets read again.

(my personal problems here are copy’n pastes, but then I had altered only the path but not the name. as such a later definition with the same name will overwrite the previous one … )