New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Forward to 410 instate of redirecting to the controller to p… #19

Merged
merged 1 commit into from Jan 11, 2018
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+7 −2
Diff settings

Always

Just for now

[BUGFIX] Forward to 410 instate of redirecting to the controller to p…

…revent a 302 redirect
  • Loading branch information...
lewisvoncken committed Jan 11, 2018
commit 7d230cb6352b16633ed2d32dde28d7527e8eff3a
@@ -22,20 +22,24 @@ class ActionPredispatch implements \Magento\Framework\Event\ObserverInterface
protected $urlParts = [];
private $resultFactory;
public function __construct(
\Magento\Framework\UrlInterface $url,
\Experius\PageNotFound\Model\PageNotFoundFactory $pageNotFoundFactory,
\Magento\Framework\App\ResponseInterface $response,
\Magento\Framework\App\ActionFactory $actionFactory,
\Magento\Framework\App\Cache\State $cacheState,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\Controller\ResultFactory $resultFactory
) {
$this->url = $url;
$this->pageNotFoundFactory = $pageNotFoundFactory;
$this->response = $response;
$this->actionFactory = $actionFactory;
$this->cacheState = $cacheState;
$this->scopeConfig = $scopeConfig;
$this->resultFactory = $resultFactory;
}
private function isEnabled(){
@@ -151,7 +155,8 @@ protected function redirect($url)
{
if($url=='410'){
$url = $this->url->getUrl('experius_pagenotfound/response/gone', ['_secure' => true]);
$result = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_FORWARD);
return $result->setModule('experius_pagenotfound')->setController('response')->forward('gone');
} else {
// add all configured params to redirect url. <included_params_redirect>
$queryStart = ($this->urlHasParams($url)) ? '&' : '?';
ProTip! Use n and p to navigate between commits in a pull request.