How to redirect a customer to a custom 404 error page in CS-Cart Print

  • 17

In order to redirect a customer to a custom 404 error page you should:

1) Create a custom page in the root directory of your CS-Cart installation (or to redirect to the homepage, use index.php)

2) In  "fn.control.php" file located in the "core" directory of your CS-Cart installation, replace the following part of code:

 if ($status == CONTROLLER_STATUS_NO_PAGE) {
    header(' ', true, 404);
}

 with this one:

 if ($status == CONTROLLER_STATUS_NO_PAGE) {
    fn_redirect(Registry::get('config.http_location') . "/NEWURL");
}


Note: In the new code, you would replace "NEWURL" with the name of the new page.
Example, to redirect to the homepage:

 if ($status == CONTROLLER_STATUS_NO_PAGE) {
    fn_redirect(Registry::get('config.http_location') . "/index.php");
}


Was this answer helpful?

« Back