Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustments to support installations without fast_404 with no failures #8

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docroot/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
// @see https://govdex.gov.au/jira/browse/GOVCMS-993
// @see https://github.com/drupal/drupal/blob/7.x/sites/default/default.settings.php#L518
// @see https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/drupal_fast_404/7.x
include_once($contrib_path . '/fast_404/fast_404.inc');
$conf['fast_404_exts'] = '/^(?!robots)^(?!sites\/default\/files\/private).*\.(?:png|gif|jpe?g|svg|tiff|bmp|raw|webp|docx?|xlsx?|pptx?|swf|flv|cgi|dll|exe|nsf|cfm|ttf|bat|pl|asp|ics|rtf)$/i';
$conf['fast_404_html'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>';
$conf['fast_404_string_whitelisting'] = array('robots.txt', 'system/files');
Expand Down Expand Up @@ -57,8 +56,12 @@ public function __toString() {
}
}

$conf['404_fast_html'] = new govCms404Page($conf['fast_404_html']);
fast_404_ext_check();
// Import Fast404 settings only when the Drupal module is found.
if (file_exists($contrib_path . '/fast_404/fast_404.inc')) {
include_once($contrib_path . '/fast_404/fast_404.inc');
$conf['404_fast_html'] = new govCms404Page($conf['fast_404_html']);
fast_404_ext_check();
}

// Ensure redirects created with the redirect module are able to set appropriate
// caching headers to ensure that Varnish and Akamai can cache the HTTP 301.
Expand Down