TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 05:56:48 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 301
  • Total: 302
  • @rjen

[How-To] Using a TinyPortal Article for your 404 Error Page!

Started by Ken., February 14, 2014, 07:03:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ken.

NOTE:
It is now late June 2018 and I've just discovered that my Custom 404 Page was not displaying correctly. It had dropped the navigation bar at the top of the page.
So, what was broken? The ".htaccess" had gotten the code for the redirect scrambled and needed to be corrected. I've added some notations to this topic from 2014 to help define this issue a little better.

If you have a custom page in place already and it's not displaying correctly, your .htaccess file would be a good place to check first.
Don't already have a custom page? Well, here's the information you need to get started!
  O0
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------

This is a short and simple two step how-to for using your TinyPortal Article system to set up a custom 404 error page.

As we all know the default 404 error pages are rather bland and boring so when Mick posted his '[Tip] Create a 404 Not Found Page' back in 2010 I was all over it and made a nice little page for my site and was well pleased with it.
As Mick said in his post:
Quote
Your visitors may stumble into a 404 "Not found" page on your website for a variety of reasons:

    * A mistyped URL, or a copy-and-paste mistake
    * Broken or truncated links on web pages or in an email message
    * Moved or deleted content

Confronted by a 404 page, they may then attempt to manually correct the URL, click the back button, or even navigate away from your site.

This code will actually show your forum and let them know that your forum does exists and make them to at least try again.
Then fast forward to this January when my site was reopened after it being off line for all of 2013. That's when it was discovered that my 404 error page no longer worked. So after some research this is what I came up with.

Please note that while this worked well for me, care should be taken to do backups of your database and the files involved in case you have a problem of some kind.
... be sure to use the information at the bottom of this post for help in editing files.


1/ First, make a TinyPortal Article with the content that you would like to be displayed whenever someone pulls up a 404 error page on your site.
... you can see my current article HERE.

2/ Next in your sites public html folder look for the '.htaccess' file.
... backup, backup, backup.  :)  (see the link below)
Adjust the code below to fit your new 404 error article and add the resulting code to the end of your .htaccess file.
ErrorDocument 404 /yourforumname/index.php?page=yourarticlepagenumber
NOTE: this is the line of code that can get corrupted, it must not be the full url of your forum, but it should be like mine,(using your information) as seen here:
ErrorDocument 404 /FamilyForum/index.php?page=208

Now you can test your newly installed 404 error page by entering a broken address for your forum into your browser.
For mine it looks like this:
https://www.ourfamilyforum.org/FamilyForum/index.php  ... my forums address.
https://www.ourfamilyforum.org/FamilyFor   ... broken address that will take you to my 404 error page.

----------------------------------------------
----------------------------------------------
Useful Links:

1/ Google Product Forums › Webmaster Central › ... in this topic 'ets' gave me some spot on help in sorting out the code for my .htaccess file.

2/ Need an FTP file utility? My favorite is FileZilla.
If you do not have a FTP program (or don't know how to use one) you can use your hosting's control panel (such as File Manager in your cPanel) to download and upload the file. You can even use it to directly edit the file, if needed... be very cautious when using this method!

3/ Any time you do anything to your forum there is one thing that you should make part of your routine, like:

Backup... Backup... Backup!

When editing a file I generally do this;

    Make a temp folder on my desktop...
    Open the site with the FileZilla FTP utility...
    Download a copy of the file in question and place it in the temp folder...
    Then download a fresh copy into my editor and edit away...
    Go back to the site and rename the existing online copy of the file to something else, like, old_filename.php...
    Then upload the edited version of the file.

When doing several files I wait until all of them have been edited so that they can all be uploaded at the same time.

If everything is OK then I'm finished.
If its all messed up I just delete the bad file that was uploaded, rename the good one to the correct file name and the forum is back to normal.

Enjoy... Ken.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

Ken.

Yesterday I discovered the my custom 404 error page was not showing the top navigation bar, or any of the other header content. Once again the .htaccess file turns out to be the guilty party because the redirect code had become corrupted. It contained the full url for my site and that is not correct, instead it should be as shown is this code in order for the file to work correctly:
ErrorDocument 404 /FamilyForum/index.php?page=208

After doing an edit to install the correct code it now works as expected, as seen  HERE.

So, this made me think that it might be a good time to bring this topic back to the fore, in case anyone else might have an issue with their page.

Click Here to get back to the first post in this topic.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.