File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 77 */
88namespace Magefan \Blog \Controller \Tag ;
99
10+ use Magento \Framework \App \Action \Context ;
1011use Magento \Store \Model \ScopeInterface ;
1112
1213/**
@@ -21,6 +22,19 @@ class View extends \Magefan\Blog\App\Action\Action
2122 */
2223 private $ _storeManager ;
2324
25+ /**
26+ * @var \Magefan\Blog\Model\Url
27+ */
28+ protected $ url ;
29+
30+ public function __construct (
31+ Context $ context ,
32+ \Magefan \Blog \Model \Url $ url = null
33+ ) {
34+ parent ::__construct ($ context );
35+ $ this ->url = $ url ?: $ this ->_objectManager ->get (\Magefan \Blog \Model \Url::class);
36+ }
37+
2438 /**
2539 * View blog author action
2640 *
@@ -34,7 +48,10 @@ public function execute()
3448
3549 $ tag = $ this ->_initTag ();
3650 if (!$ tag ) {
37- return $ this ->_forwardNoroute ();
51+ $ resultRedirect = $ this ->resultRedirectFactory ->create ();
52+ $ resultRedirect ->setHttpResponseCode (301 );
53+ $ resultRedirect ->setPath ($ this ->url ->getBaseUrl ());
54+ return $ resultRedirect ;
3855 }
3956
4057 $ this ->_objectManager ->get (\Magento \Framework \Registry::class)->register ('current_blog_tag ' , $ tag );
You can’t perform that action at this time.
0 commit comments