I've assigned page for 404 error handling (example.com/404).
I've created Rules condition: Data to compare: [site:current-page:url], Data value: 404.
And I've created some Rules action for this case.

But when I open nonexistent page (example.com/wrong) - there is no corresponding Rules action.
It is because I see 'example.com/wrong' address instead of 'example.com/404'

But how can I create Rules condition for event when 404 error generated?


Navigate to this path admin/config/system/site-information, which will look like www.example.com/admin/config/system/site-information.

Enter the page URL(your page for 404) in the 'Default 404 (not found) page', where you want to navigate your user when 404 happens.

Note - I don't think you can detect 404 from rules. May be somebody can answer about that but not me. Though I have experience with rules but never seen this kind of thing.


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".

  • No news/feedback about this answer? – Pierre.Vriens Oct 11 '15 at 14:58

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.