Skip to main content

Home/ Drupal for Developers/ Group items tagged error handling

Rss Feed Group items tagged

Daniel Gregoire

Reducing server resource utilization for busy sites by implementing fast 404s in Drupal... - 3 views

  • // List of extensions for static files $exts = 'txt|png|gif|jpe?g|shtml?|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|xml'; // It is not an imagecache path, which we allow to go through Drupal if (!strpos($_SERVER['QUERY_STRING'], 'imagecache')) { // It is not our main feed page if ($_SERVER['QUERY_STRING'] != 'rss.xml') { // Is it a static file? if (preg_match('/\.(' . $exts . ')$/', $_SERVER['QUERY_STRING'])) // Just send a 404 right now ... { header('HTTP/1.0 404 Not Found'); print '<html>'; print '<head><title>404 Not Found</title></head>'; print '<body><h1>Not Found</h1>'; print '<p>The requested URL was not found on this server.</p>'; print '</body></html>'; exit(); } } }
  •  
    Fast Drupal 404 handling for static files.
1 - 1 of 1
Showing 20 items per page