File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
app/code/Magento/Cms/Controller/Noroute Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,6 @@ public function __construct(
32
32
*/
33
33
public function execute ()
34
34
{
35
- /** @var \Magento\Backend\Model\View\Result\Forward $resultForward */
36
- $ resultForward = $ this ->resultForwardFactory ->create ();
37
- $ resultForward ->setHeader ('HTTP/1.1 ' , '404 Not Found ' );
38
- $ resultForward ->setHeader ('Status ' , '404 File not found ' );
39
-
40
35
$ pageId = $ this ->_objectManager ->get (
41
36
'Magento\Framework\App\Config\ScopeConfigInterface ' ,
42
37
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
@@ -47,11 +42,16 @@ public function execute()
47
42
/** @var \Magento\Cms\Helper\Page $pageHelper */
48
43
$ pageHelper = $ this ->_objectManager ->get ('Magento\Cms\Helper\Page ' );
49
44
$ resultPage = $ pageHelper ->prepareResultPage ($ this , $ pageId );
50
- if (!$ resultPage ) {
45
+ if ($ resultPage ) {
46
+ $ resultPage ->setHeader ('HTTP/1.1 ' , '404 Not Found ' );
47
+ $ resultPage ->setHeader ('Status ' , '404 File not found ' );
48
+ return $ resultPage ;
49
+ } else {
50
+ /** @var \Magento\Backend\Model\View\Result\Forward $resultForward */
51
+ $ resultForward = $ this ->resultForwardFactory ->create ();
51
52
$ resultForward ->setController ('index ' );
52
53
$ resultForward ->forward ('defaultNoRoute ' );
53
54
return $ resultForward ;
54
55
}
55
- return $ resultPage ;
56
56
}
57
57
}
You can’t perform that action at this time.
0 commit comments