Magento 2 : How to forward controller defaultNoRoute?Magento 2 Create custom 404 page for not-found productsStatus 200 for 404 Not Found CMS page404 - Redirect to Home Page - Banner Slider Not WorkingMagento 404 errors are showing the standard apache 404 error instead of custom Magento 404404 on startup page changing admin panel URLHow to forward all the 404 Magento pages to the front page?URL Rewrite and 301 Permission not working properly404 Not Found 1 when view product detail page after customer loggingFrontend layout not working after upgrading to Magento 2.1How to redirect 404 error to specific url?Magento 2 : custom no-route url in nginx server
Parsing text written the millitext font
Is Jesus the last Prophet?
Is the first of the 10 Commandments considered a mitzvah?
Why is my Taiyaki (Cake that looks like a fish) too hard and dry?
Am I being scammed by a sugar daddy?
Does WiFi affect the quality of images downloaded from the internet?
Can I attach a DC blower to intake manifold of my 150CC Yamaha FZS FI engine?
Fully extended TQFT and lattice models
Is it true that "only photographers care about noise"?
How (un)safe is it to ride barefoot?
How do I properly use a function under a class?
Realistic, logical way for men with medieval-era weaponry to compete with much larger and physically stronger foes
My mom's return ticket is 3 days after I-94 expires
Why does there seem to be an extreme lack of public trashcans in Taiwan?
As easy as Three, Two, One... How fast can you go from Five to Four?
Nth term of Van Eck Sequence
Did I need a visa in 2004 and 2006?
Undocumented incompatibility between changes and siunitx?
Which are the methodologies for interpreting Vedas?
Is it good practice to create tables dynamically?
I sent an angry e-mail to my interviewers about a conflict at my home institution. Could this affect my application?
What is the theme of analysis?
What did the 8086 (and 8088) do upon encountering an illegal instruction?
Why did the AvroCar fail to fly above 3 feet?
Magento 2 : How to forward controller defaultNoRoute?
Magento 2 Create custom 404 page for not-found productsStatus 200 for 404 Not Found CMS page404 - Redirect to Home Page - Banner Slider Not WorkingMagento 404 errors are showing the standard apache 404 error instead of custom Magento 404404 on startup page changing admin panel URLHow to forward all the 404 Magento pages to the front page?URL Rewrite and 301 Permission not working properly404 Not Found 1 when view product detail page after customer loggingFrontend layout not working after upgrading to Magento 2.1How to redirect 404 error to specific url?Magento 2 : custom no-route url in nginx server
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I create a custom module in which if data is found the template is shown else I need to show default 404-page content & set the status to 404.
I have tried below code to set the status to 404 without changing the URL(i.e, not redirecting to noroute)
$resultPage->setStatusHeader(404, '1.1', 'Page Not Found');
$resultPage->setHeader('Status', '404 Page Not Found');
But I'm unable to show the default 404 error page content.
I have tried below code to forward the controller to default no route page, but it's not working for me.
$this->_forward('defaultNoRoute');
Can anyone help me out from this? Thanks in advance.
magento2 404-page 404 noroute
add a comment |
I create a custom module in which if data is found the template is shown else I need to show default 404-page content & set the status to 404.
I have tried below code to set the status to 404 without changing the URL(i.e, not redirecting to noroute)
$resultPage->setStatusHeader(404, '1.1', 'Page Not Found');
$resultPage->setHeader('Status', '404 Page Not Found');
But I'm unable to show the default 404 error page content.
I have tried below code to forward the controller to default no route page, but it's not working for me.
$this->_forward('defaultNoRoute');
Can anyone help me out from this? Thanks in advance.
magento2 404-page 404 noroute
add a comment |
I create a custom module in which if data is found the template is shown else I need to show default 404-page content & set the status to 404.
I have tried below code to set the status to 404 without changing the URL(i.e, not redirecting to noroute)
$resultPage->setStatusHeader(404, '1.1', 'Page Not Found');
$resultPage->setHeader('Status', '404 Page Not Found');
But I'm unable to show the default 404 error page content.
I have tried below code to forward the controller to default no route page, but it's not working for me.
$this->_forward('defaultNoRoute');
Can anyone help me out from this? Thanks in advance.
magento2 404-page 404 noroute
I create a custom module in which if data is found the template is shown else I need to show default 404-page content & set the status to 404.
I have tried below code to set the status to 404 without changing the URL(i.e, not redirecting to noroute)
$resultPage->setStatusHeader(404, '1.1', 'Page Not Found');
$resultPage->setHeader('Status', '404 Page Not Found');
But I'm unable to show the default 404 error page content.
I have tried below code to forward the controller to default no route page, but it's not working for me.
$this->_forward('defaultNoRoute');
Can anyone help me out from this? Thanks in advance.
magento2 404-page 404 noroute
magento2 404-page 404 noroute
asked Jun 6 at 10:18
Mandar ParbateMandar Parbate
302623
302623
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You Can Override MagentoFrameworkAppRouterNoRouteHandlerList
File In app/code/Vendor/Module/etc/frontend/di.xml
And You Can Add Your Code Like This :-
public function execute()
$resultLayout = $this->resultPageFactory->create();
$resultLayout->setStatusHeader(404, '1.1', 'Not Found');
$resultLayout->setHeader('Status', '404 File not found');
return $resultLayout;
Reference Link
Create custom 404 page for not-found products
add a comment |
Use this class for redirection
public function __construct
(
MagentoFrameworkControllerResultForwardFactory $forwardFactory
)
$this->_forwardFactory = $forwardFactory;
Now you can redirect to 404 page using this
if(CONDITION)
$resultForward = $this->_forwardFactory->create();
$resultForward->setController('index');
$resultForward->forward('defaultNoRoute');
return $resultForward;
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f277459%2fmagento-2-how-to-forward-controller-defaultnoroute%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You Can Override MagentoFrameworkAppRouterNoRouteHandlerList
File In app/code/Vendor/Module/etc/frontend/di.xml
And You Can Add Your Code Like This :-
public function execute()
$resultLayout = $this->resultPageFactory->create();
$resultLayout->setStatusHeader(404, '1.1', 'Not Found');
$resultLayout->setHeader('Status', '404 File not found');
return $resultLayout;
Reference Link
Create custom 404 page for not-found products
add a comment |
You Can Override MagentoFrameworkAppRouterNoRouteHandlerList
File In app/code/Vendor/Module/etc/frontend/di.xml
And You Can Add Your Code Like This :-
public function execute()
$resultLayout = $this->resultPageFactory->create();
$resultLayout->setStatusHeader(404, '1.1', 'Not Found');
$resultLayout->setHeader('Status', '404 File not found');
return $resultLayout;
Reference Link
Create custom 404 page for not-found products
add a comment |
You Can Override MagentoFrameworkAppRouterNoRouteHandlerList
File In app/code/Vendor/Module/etc/frontend/di.xml
And You Can Add Your Code Like This :-
public function execute()
$resultLayout = $this->resultPageFactory->create();
$resultLayout->setStatusHeader(404, '1.1', 'Not Found');
$resultLayout->setHeader('Status', '404 File not found');
return $resultLayout;
Reference Link
Create custom 404 page for not-found products
You Can Override MagentoFrameworkAppRouterNoRouteHandlerList
File In app/code/Vendor/Module/etc/frontend/di.xml
And You Can Add Your Code Like This :-
public function execute()
$resultLayout = $this->resultPageFactory->create();
$resultLayout->setStatusHeader(404, '1.1', 'Not Found');
$resultLayout->setHeader('Status', '404 File not found');
return $resultLayout;
Reference Link
Create custom 404 page for not-found products
answered Jun 6 at 11:09
Rk RathodRk Rathod
2,261315
2,261315
add a comment |
add a comment |
Use this class for redirection
public function __construct
(
MagentoFrameworkControllerResultForwardFactory $forwardFactory
)
$this->_forwardFactory = $forwardFactory;
Now you can redirect to 404 page using this
if(CONDITION)
$resultForward = $this->_forwardFactory->create();
$resultForward->setController('index');
$resultForward->forward('defaultNoRoute');
return $resultForward;
add a comment |
Use this class for redirection
public function __construct
(
MagentoFrameworkControllerResultForwardFactory $forwardFactory
)
$this->_forwardFactory = $forwardFactory;
Now you can redirect to 404 page using this
if(CONDITION)
$resultForward = $this->_forwardFactory->create();
$resultForward->setController('index');
$resultForward->forward('defaultNoRoute');
return $resultForward;
add a comment |
Use this class for redirection
public function __construct
(
MagentoFrameworkControllerResultForwardFactory $forwardFactory
)
$this->_forwardFactory = $forwardFactory;
Now you can redirect to 404 page using this
if(CONDITION)
$resultForward = $this->_forwardFactory->create();
$resultForward->setController('index');
$resultForward->forward('defaultNoRoute');
return $resultForward;
Use this class for redirection
public function __construct
(
MagentoFrameworkControllerResultForwardFactory $forwardFactory
)
$this->_forwardFactory = $forwardFactory;
Now you can redirect to 404 page using this
if(CONDITION)
$resultForward = $this->_forwardFactory->create();
$resultForward->setController('index');
$resultForward->forward('defaultNoRoute');
return $resultForward;
answered Jun 6 at 11:44
user4536user4536
15313
15313
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f277459%2fmagento-2-how-to-forward-controller-defaultnoroute%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown