Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function match(RequestInterface $request)
- {
- $rewrite = $this->getRewrite(
- $request->getPathInfo(),
- $this->storeManager->getStore()->getId()
- );
- $identifier = trim($request->getPathInfo(), '/');
- if($identifier==='testing'){
- $rewrite = new UrlRewrite();
- $rewrite->setTargetPath("catalog/category/view/id/18");
- $rewrite->setRequestPath("testing");
- $rewrite->setRedirectType(0);
- $rewrite->setEntityType("category");
- //return $this->processRedirect($request, $rewrite);
- }
- if ($rewrite === null) {
- //No rewrite rule matching current URl found, continuing with
- //processing of this URL.
- return null;
- }
- if ($rewrite->getRedirectType()) {
- //Rule requires the request to be redirected to another URL
- //and cannot be processed further.
- return $this->processRedirect($request, $rewrite);
- }
- //Rule provides actual URL that can be processed by a controller.
- $request->setAlias(
- UrlInterface::REWRITE_REQUEST_PATH_ALIAS,
- $rewrite->getRequestPath()
- );
- $request->setPathInfo('/' . $rewrite->getTargetPath());
- return $this->actionFactory->create(
- MagentoFrameworkAppActionForward::class
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement