in our magento application we have somehow a 302 redirect from /customer/account
into /connexion
. I would like to change it into a 301 one. No idea how to process this.
This seems to be handled in a specific plugin
di.xml
<type name="Magento\Framework\Url">
<plugin name="custom_login_url" type="Cpy\MyModule\Plugin\Framework\Url" disabled="false" />
</type>
Url.php
<?php
namespace Cpy\MyModule\Plugin\Framework;
class Url
{
public function aroundGetUrl($subject, $callable, $routePath = null, $routeParams = null)
{
if($routePath == 'customer/account/login') {
$routePath = 'connexion';
$routeParams = null;
}
return $callable($routePath, $routeParams);
}
}
Any ideas ?
EDIT :
<?php
namespace Cpy\MyModule\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action
{
public function execute()
{
$this->_forward('login', 'account', 'customer');
}
}