404 Not Found Page

faridadobani5832

New Member
YetiShare User
Mar 28, 2016
17
0
1
Hello,

I want to show a 404 Not Found Page if the URL is really not on the server.

For e.g example.com/iamnotafile This shows a blank page instead of 404 page. How do i show a 404 Page?

Here's what I understand.

In file_download.php

Code:
// could not load the file
if (!$file)
{
    coreFunctions::output404();
    //coreFunctions::redirect(coreFunctions::getCoreSitePath() . "/index." . SITE_CONFIG_PAGE_EXTENSION);
}
This calls the output404() function in coreFunctions.class.php

Code:
static function output404()
    {
        header("HTTP/1.0 404 Not Found");
        exit;
    }
This is the 404 function. Shall I add redirect to error page?

Please give me an example.
 

yekupload5636

Member
YetiShare User
Dec 29, 2015
42
0
6
37
yekupload.ir
Hi,
You change the output404() function in coreFunctions.class.php To:
Code:
static function output404()
    {
        header( 'Location: http://site.com/404.html' );
        exit;
    }