Hello,
I would like to create an URL with $this->url()
in my view and using a Hostname type in my module.config.php file:
'front' => [
'type' => Hostname::class,
'options' => [
'route' => '[:subdomain]example[:domainname]',
'constraints' => [
'subdomain' => 'localv2.|',
'domainname' => '.com|.local',
],
],
'may_terminate' => true,
'child_routes' => [
'home' => [
'type' => Segment::class,
'options' => [
'route' => '/[:locale/]',
'constraints' => [
'locale' => 'fr',
],
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
'locale' => 'en'
],
],
'may_terminate' => true,
'child_routes' => [
'api' => [
'type' => Segment::class,
'options' => [
'route' => '{uriapi}',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'api',
],
],
'may_terminate' => true
],
]
],
],
],
The problem is when I create an URL for the route front/home/api
I have the URL https://localv2.example.com/en/api
or https://localv2.example.com/fr/api
, the problem is that I would like the URL /en/api
or /fr/api
.
I also tried $this->url('front/home/api', [], ['force_canonical' => false])
but it doesn’t works.
What I’m doing wrong please ?
Thank you.