TNG 404 Error Mod

Post Reply
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

TNG 404 Error Mod

Post by steven »

When TNG encounters a missing resource a 404 status code is sent but users get a blank page. There is no way to get back to TNG except use the browser back button.

This mod issues a 404 status code that does not change the URL while displaying a TNG page. The mod replaces all occurrences of thispagedoesnotexist.html with a function. Any links to people, families, media, cemeteries, places etc. is captured. This is a true 404 status code and not a "soft" 404 code where a page is shown or redirected resulting with a 200 page OK status code.

The way the page is displayed is dependent on the 404_page.php file. If the file is in the TNG root folder, additional content is shown. If it is not found a generic 404 page is shown. The 404_page.php file can be customized to show additional message or links. If the 404_page.php is used, languages must be added to the cust_text.php file for the active language(s). Examples of the text format is included in the message_examples.php file.

To create a 404 error manually, go to an individual's page. In the browser URL type some numbers or letters after the person id= and press enter.
By default the mod displays the 404 error and a TNG page.

Image

Administrators can change the message to something else if text is added in the cust_text.php file.

Image

Administrators can also use a 404_page.php file to display links or other messages.
The 404_page.php and message_examples.php files are included in the 404 file folder.

Image

Links can also be placed inline.

Image


You can check the network status code by opening the browsers inspection window and select Network.

Image

Select the reload option to display the page status information. The page must be reloaded because the status code is only sent when the page loads.

Image

The URL on the first line displays a 404 status code and there is a one warning at the top. The remainder of the page will show a 200 status which is normal because some page content loaded. The 404 code tells users, bots and crawlers the URL is unavailable so bots and crawlers will not store the URL address.


Image

The 404 error log lets administrators know about bad links. Keep in mind hack attempts will also be shown if someone modifies the URL. The URL will contain unusual characters and commands like AND, OR and UNION. The error log can be disabled in mod options.

404_error_mod_v14.0.0.5a.zip
(5.29 KiB) Downloaded 17 times

TNG WIKI Download Link

 
Revisions:
25 Dec 2023 - Changed inline CSS styling so mytngstyle.css can override the default CSS. Added more instructions for creating a custom 404 page.
22 Dec 2023 - Reworked mod so 404-page.php file is optional. Fixed code so users can change the default error message without using the 404-page.php
file. Added an example text file so users can add their own messages to the custtext.php file(s) for the language(s) they are using.
18 Dec 2023 - Added an error log file
16 Dec 2023 - First public release
Post Reply