If I request an image that doesn't exist like mysite.com/test/test_not_found_image.jpg, I get a Not Found white page just like this page: https://www.drupal.org/files/testing_404.jpg.

Is it possible to have Drupal show the styled 404 page that I have instead of that white 404 page?

  • I think it is done by changing the values in .htaccess. I have been able to create my own customized micro-CMS where I either redirect to 404 page or homepage for not found files, including images, and it is controlled via .htaccess. I have tried to replicate the behaviour with Drupal 7 but haven't been successful. Maybe this could help you: drupal.org/node/15366#comment-7218780 – Cesar May 24 '16 at 16:30

While @Shawn Conn's answer does work it does cause issues in Drupal because of image cache. If you go to a page that doesn't have the image style created yet it won't create the image because of the .htaccess rule.

The best way to display a 404 page on bad images is to use the Fast 404 module and create a static html page.

| improve this answer | |
  • Can confirm. I thought ImageCache generated images on save, but it's on request URL for both D7 & D8. – Shawn Conn Jul 7 '16 at 1: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.