Previous Thread
Next Thread
Print Thread
Rate Thread
#233447 01/18/2003 7:18 AM
Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
What is it?: A way to make a custom 404 error page for an Apache web server (or any web server that uses a .htaccess file.

Why would I care?: With this methode your logo, adds, menu, etc loads when someone goes to a broken link on your site. So, even though they get an error, they get your adds and menu instead of the default error page that most web browser's display.

First, add this line to your .htaccess file:

Code
 <br />ErrorDocument 404 /error.php <br />  


Next, edit my error.php file adding your comments between the paragraph tags. If your Threads install is in a directory named ubbthreads under web root then there is no need to edit the line that requires the library. Otherwise you'll have to change the path to main.inc.php as well.

Upload the error.php file to your web root.

Enjoy
Attachments
65351-error.zip (0 Bytes, 12 downloads)

Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Nice thinking!

You can take this further by using these in your .htaccess:



The error pages have been placed into a specific directory "errorpages" of their own. I went and used .threads send_header/send_footer and placed the error page names into the language files for "online.php" so that I can see what errors are occuring live. (well almost live)




Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
LOL!

I added:

Code
 $ubbt_lang['error'] = "Reading the Error page"; 


to the /ubbthreads/languages/english/online.php file right after I made my post

Most of the errors I get are 404 (file not found) because I moved all my articles over to Threads, and the old site was rated very high in all the search engines.

Good idea on the other errors!

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
I rarely see any errors other than 404's as well but once in a while you'd be surprised. I haven't looked but does your error page allow the viewer to send the webmaster a notice about the error? I also have my own error pages redirect to the index after 10 seconds.

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268

Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Very nice!

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
Thanks

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Nice work it works great.

see it here

One caution though. I used Dave's advice and added all the page error codes. However any one that has banner ads for sponsor's might want to not include the following error pages as this will break an otherwise working link.

ErrorDocument 302 /error.php
ErrorDocument 301 /error.php

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
Good job on the error page!

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
One small suggestion there Chuck.

The page looks wonderful but you could be better off with removing the email address to the webmaster and replacing it with some sort of a hybrid of Josh's Contact Us form, to avoid spam spiders. Usually spiders will query the server for a 404 and grab the webmasters address...

Warm regards

Nikos


Nikos
Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Good tip.

I've had a custom 404 for some time... especially when we switched from the wwwthreads to a forums directory.

Here.


Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Dah I actually have his mod installed.

Changed the link to contactus.php


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)