scopeConfig = $scopeConfig; } /** * Performs verification. * * @param array $uri * @param \Magento\Framework\App\Request\Http $request * @return bool */ public function execute($uri, $request) { $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/'; return (!isset( $uri['scheme'] ) || $uri['scheme'] === $request->getScheme()) && (!isset( $uri['host'] ) || $uri['host'] === $request->getHttpHost()) && (!isset( $uri['path'] ) || strpos( $requestUri, $uri['path'] ) !== false); } /** * Checks whether base URL verification is enabled or not. * * @return bool */ public function isEnabled() { return (bool) $this->scopeConfig->getValue( 'web/url/redirect_to_base', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } }