you can customize (404) page from admin
Content->Pages->404 Not Found->Edit->content
here you can change whatever content you need.
If you look programmatically solution, add the below content in your <root-magent>/app/code/Vendor/Module/etc/di.xml
<type name="Magento\Framework\App\Router\NoRouteHandlerList">
<arguments>
<argument name="handlerClassesList" xsi:type="array">
<item name="default" xsi:type="array">
<item name="class"
xsi:type="string">Vendor\Module\Controller\NoRouteHandler</ite
m>
<item name="sortOrder" xsi:type="string">200</item>
</item>
</argument>
</arguments>
</type>
add this content in above mentioned controller
<?php
namespace Vendor\Module\Controller;
class NoRouteHandler implements \Magento\Framework\App\Router\NoRouteHandlerInterface {
public function process(\Magento\Framework\App\RequestInterface $request) {
$moduleName= 'cms';
$controllerName = 'index';
$actionName= 'index';
$request
->setModuleName($moduleName)
->setControllerName($controllerName)
->setActionName($actionName);
return true;
}
}
In this controller you can set whatever module/controller/actionname for 404 page.
follow this link to set 401,403,500 page
I don't know exactly HOW it happened, but in my scenario the core_config_data
table was corrupted. It had added a new row somehow with path
set to general
and value
set to NULL
:
This caused Magento\Framework\App\Config\ScopeConfigInterface::getValue()
on public/vendor/magento/framework/Stdlib/DateTime/Timezone.php::scopeDate()
to return NULL
instead of Europe/Amsterdam
. Needless to say, when the \DateTimeZone()
object was created it immediately threw this exception.
So if anyone else encounters this error, your configuration might be an obvious place to start looking.
Best Answer
First, create a 500.html page in your document root (usually a public_html/ or www/ directory).This should probably be a static HTML page rather than anything dynamic (i.e. PHP). Then Add the following rule to the start of your Magento .htaccess
This will then redirect any requests for an error report page using a 500 response code (Internal server error) and display the 500.html page in place of the standard Magento page.