The 404 error mod gives users a TNG error page instead of a blank page which may cause them to abandon your website. When the mod encounters an error, it sends a network 404 status code, displays a TNG page, creates a 404_error_log.txt file, if enabled, in the TNG folder with an error line message. The 404 error text file is created when a TNG page cannot be found. If the error text file is deleted, it will be created when the next error occurs.

**Keep in mind the error log will capture pages when someone enters incorrect information in the URL. This can happen if someone tries to inject code in the URL. Fortunately Darrin has done a great job securing the TNG code. In any case, if you do not want to use the error log, change the mod option to disable it.

By default the mod displays a TNG page with 404 ERROR - PAGE NOT FOUND message in English using the active template. Additional languages and custom 404 page content can be displayed using the optional 404 Error Custom Page Mod located in the 404 error mod folder. This mod adds a 404_page.php file in the TNG folder and modifies cust_text.php files. The defaults are; one Go Back button and two links to search for people and families. The button and links can be modified or commented out depending on preferences. The PHP file contains inline CSS, to customize the appearance.



To use the optional 404 page file, copy the 404_error_page_v15.0.2.1.cfg file to the mods folder. When this file is installed the 404_page.php file is copied to the TNG folder and the language cust_text.php files are modified.

Languages modified are: Czech, Czech-UTF8, Danish, Danish-UTF8, Dutch, Dutch-UTF8, English, English-UTF8, Finnish, Finnish-UTF8, French, French-UTF8, German, German-UTF8, Italian, Italian-UTF8, Norwegian, Norwegian-UTF8, Polish-UTF8, PortugueseBR, PortugueseBR-UTF8, Spanish, Spanish-UTF8, Swedish and Swedish-UTF8.

To add or edit a language copy the 404_error_page_v15.0.2.1.cfg to the mods folder. Make the needed changes and install the mod. If you make a syntax mistake, a missing quote or semi-colon you will get a blank page. To correct this go to the current language and open the cust_text.php file. Then delete this section which will be in the current language:
// 404 Mod Begin
	$errmessage = "404 ERROR - Page Not Found";
	$errlink1 = "Go Back";
	$errlink2 = "Search People";
	$errlink3 = "Search Families";
// 404 Mod End
(Including the blank line here)

When you return to TNG the mod will say partially installed. Select cleanup and correct the mistake before reinstalling. If you change multiple languages check each one to ensure the syntax is correct.

Using the 404_error_custom_page_v15.0.2.1.cfg file is optional and only needed to show a custom error page. This is useful if the active template does not show the TNG navigation menu below the page header.
The 404_page.php file is a protected file so it is not deleted when you uninstall the mod. This preserves your custom page during updates. If you want to completely delete the mod, this file must be deleted manually.
The 404_page.php file uses span instead of div. So if you remove all the breaks <br/>, the buttons will be appear inline. You can change spans to divs to use block level styling for a specific div or all of them.

************ UPGRADING TO v15.0.2.1 ************
1 - Uninstall and delete the 404​_error​_v15​.0​.1​.5​.cfg config file.
2 - Copy the new 404​_error​_v15​.0​.2​.1​.cfg file to the mods folder.
3 - Install the new file.

If you are using a custom 404 page follow the instructions below to retain your changes.
	If the 404_page.php file, has been customized, DO NOT delete the file. It can be used with the v15.0.2.1 upgrade.
	If languages in the older 404​_error​_page​_v15​.0​.1​.5​.cfg file were modified proceed with items 4 thought 8.
	4 - Copy the changes to the new 404​_error​_page​_v15​.0​.2.1​.cfg file.
	5 - After the changes are completed, uninstall and delete the 404​_error​_page​_v15​.0​.1​.5​.cfg file.
	6 - Delete the old 404_error_v15.0.1.5 folder, if it still exists.
	7 - Copy the new 404​_error​_page​_v15​.0​.2.1​.cfg file to the mods folder.
	8 - Install the 404​_error​_page​_v15​.0​.2.1​.cfg file.

You can test the mod by going to a person or family page and change the ID or tree number. If you are not logged in you will be banned and must remove you IP address from the .htaccess file. If you leave your IP address in the blacklist.dat file you cannot be banned again unless your IP address changes.

If you change your mind and do not want to use the custom 404_page.php file, uninstall the 404 Error Custom Page mod and manually delete the 404_page.php file. If you uninstall the 404_error_custom_page and do not manually delete the 404_page.php file, the default error message will be shown in English.

Note: manually deleting the 404_page.php file, with the mod installed, will not cause an error but will cause a partially installed notice in mod manager.


Additional info:
After careful monitoring I found nearly every 404 error was the result of a user or bot injecting code in the URI. This version adds an option to send the client to Bot-trap. If Bot-trap is not installed the option will not appear. Logged in users are never banned and will get a normal 404 page.
