0

What I am trying to do is redirecting users to a custom page, instead of showing the standard error message, when a 403 or 404 error happens.

I tried to use /error/404 on the Base site settings page and create a node with that path alias, but it didn’t work. When I try to access some random URL, it still shows a standard error message, not the /error/404 node.

Did I misunderstand how the feature work? Should I try another approach?

6
  • You need to specify the node path that will be displayed as error page. It's difficult to tell do you just want to display custom content on 403/404 or do you really want to redirect and if so, why? Then maybe just have a look at drupal.org/project/r4032login and how they did it.
    – leymannx
    Dec 17 '19 at 11:44
  • what error message does it show?
    – sonfd
    Dec 17 '19 at 14:09
  • 1
    You don't need an alias, because the custom 403/404 page won't be a redirect. It will be displayed under the same URL which caused the 403/404. So simply configure an existing node and it should work: /node/123
    – 4k4
    Dec 17 '19 at 16:43
  • @sonfd It shows just "The requested page could not be found" when I enter some random incorrect url.
    – Sergey
    Dec 18 '19 at 6:09
  • @leymannx Thank you for the advice. I want to display custom content when 403 or 404 error occurs. I don't need redirect.
    – Sergey
    Dec 18 '19 at 6:13
2

This is build in to Drupal and the simple way to do this is to create separate pages for both error codes and add your own wording as necessary.

Then go to the error pages section of site settings at /admin/config/system/site-information and add the path of your custom error pages.

1
  • OP is telling they did exactly that and it didn't work.
    – leymannx
    Dec 17 '19 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.