Skip to content

Fast 404

Ben Gillbanks edited this page Jul 28, 2020 · 5 revisions

Disable 404's for static files.

This means that if an image (or other static file) is included in a page, and it doesn't exist, the entire 404 page will not be loaded.

An example of when this might be bad, would be if an image is deleted but still loaded somewhere. With normal WordPress this will make a request for a non-existant file, which will then generate a 404 response loading the 404 page. This will in turn perform database requests for widgets and other content that might be on the page.

The list of files currently blocked includes:

	$bad_file_types = array(
		'css',
		'txt',
		'jpg',
		'gif',
		'rar',
		'zip',
		'png',
		'bmp',
		'tar',
		'doc',
		'xml',
		'js',
		'docx',
		'xls',
		'xlsx',
		'svg',
		'webp',
	);

Clone this wiki locally