Skip to content

Custom 404 Page

risingisland edited this page Aug 23, 2024 · 1 revision

The standard content file for the error 404 page is created and saved in “/data/other/404.xml”.

To customize it create a new page with slug 404. It will override the standard version.

The code is in index.php

# define page, spit out 404 if it doesn't exist
$file = GSDATAPAGESPATH . $id .'.xml';
$file_404 = GSDATAOTHERPATH . '404.xml';
$user_created_404 = GSDATAPAGESPATH . '404.xml';
if (! [file_exists](http://www.php.net/file_exists)($file)) {
	if ([file_exists](http://www.php.net/file_exists)($user_created_404)) {
		//user created their own 404 page, which overrides the default 404 message
		$file = $user_created_404;
	} elseif ([file_exists](http://www.php.net/file_exists)($file_404))	{
		$file = $file_404;
	}
	exec_action('error-404');
}

Clone this wiki locally