I set a page for the 404 error. I created the Data to compare: [site:current-page:url], Data value: 404 condition and an action of that condition.

When a non existing page is requested, no action is triggered. I guess it happens because the page URL is https://example.com/wrong, instead of https://example.com/404.

How can I create condition for a 404 error?

  • I don't think you can detect 404 using the Rules module. Maybe somebody can answer about that but not me. I have experience with the Rules module but I have never seen this done.
    – RajeevK
    Commented Nov 19, 2013 at 17:47

1 Answer 1


Try using Rules (System) event "Drupal is initializing" (= init), which is actually BEFORE a node is being viewed.

Not sure if the Rules condition you're using is OK. But if you still can't get it to work, you may also want to look at my answer to the question "How to restrict access to a node via node/12 and allow access via a path like content/sometitle?". The sample there also includes such "Drupal is initializing".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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