Custom 404 Page For Non Registers Users?

I would like to make one content page only visible to our registered users.I changed the page availability settings following way: Please see attached.

The page is now only visible to registered users. However, non-registered users now get the 404 message which is misleading. Instead of the 404 page, we want to display a custom content page. How i can achieve this redirection using code edit. Please any one.
Current version : 4.2.1

Screenshot_1.png

app/functions/fn.control.php

if ($area == 'A') {
    $view->assign('content_tpl', 'exception.tpl'); // for backend only
}

with

if ($area == 'A') {
    $view->assign('content_tpl', 'exception.tpl'); // for backend only
} elseif (empty($_SESSION['auth']['user_id'])) {
    fn_redirect("pages.view?page_id=123");
}

where 123 - is the ID of the content page. It can be found in the admin panel.

(!) Not tested

Thanks for the quick reply. Now all of the unavailable pages has been redirected to custom page. Still i need 404 error message for unavailable web pages. Please help

Please any one...

Thanks for the quick reply. Now all of the unavailable pages has been redirected to custom page. Still i need 404 error message for unavailable web pages. Please help

Please clarify what do you mean?

I would like to expect separate 404 page for non registered users when they try to access authenticated content pages. It will be different for regular 404 error page. Hope you understand.

I would like to expect separate 404 page for non registered users when they try to access authenticated content pages. It will be different for regular 404 error page. Hope you understand.

What pages do you mean by "authenticated content" ?

As you know if we check "Registered users" check box under Availability. It's supposed to be a authenticated page. Please see the attached screenshot.

Screenshot_2.png

Please check the following code in the app/controllers/frontend/products.php file:

if (!in_array(USERGROUP_ALL, $uids) && !in_array(USERGROUP_GUEST, $uids)) {
      return array(CONTROLLER_STATUS_REDIRECT, 'auth.login_form?return_url=' . urlencode(Registry::get('config.current_url')));
}

It checks product availability and makes redirect

I would like to expect page availability and redirect not a product availability. Please provide the file name for Page availability redirection.